public bool CreatePOS(POSCreate model) { POS entity = new POS() { CardCarrier = model.CardCarrier, CardNumber = model.CardNumber, CardDate = model.CardDate, CardCV = model.CardCV, AutoPay = model.AutoPay, PropertyID = model.PropertyID, /*FK; requires space provided in data and model otherwise virtual default is nullable*/ }; _context.PointOfSale.Add(entity); return(_context.SaveChanges() == 1); }
public ActionResult Create(POSCreate model) { //model.PropertyID = 1; if (!ModelState.IsValid) { return(View(model)); } var service = EstablishPOSService(); if (service.CreatePOS(model)) { return(RedirectToAction("Index")); } ModelState.AddModelError("", "POS receipt could not be created."); return(View(model)); }