I have an MVC application that has some CRUD functionality, I've noticed that upon creating a new record, one of the fields that supposed to be automatically generated returns 0. Is there a way I can populate this field to increment every time a new record is created. Thanks.
Test shows how StoreNumber remains 0 whenever I add records.

Controller:
public ActionResult Create()
{
ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "CustomerCompanyName");
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "StoreID,CustomerID,StoreName,StoreUID,StoreNumber,StoreLogo,StoreLogoPath,StoreAddress,StoreCity,StoreRegion,StoreCountry")] Store store)
{
if (ModelState.IsValid)
{
store.StoreUID = Guid.NewGuid();
db.Stores.Add(store);
db.SaveChanges();
return RedirectToAction("Index");
}
ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "CustomerCompanyName", store.CustomerID);
return View(store);
}
Store Class
public partial class Store
{
public int StoreID { get; set; }
public int CustomerID { get; set; }
public string StoreName { get; set; }
public System.Guid StoreUID { get; set; }
public int StoreNumber { get; set; }
public string StoreLogo { get; set; }
public string StoreLogoPath { get; set; }
public string StoreAddress { get; set; }
public string StoreCity { get; set; }
public string StoreRegion { get; set; }
public string StoreCountry { get; set; }
public virtual Customer Customer { get; set; }
}