public ActionResult Create([Bind(Include = "PersonID,FullName,PreferredName,SearchName,IsPermittedToLogon,LogonName,IsExternalLogonProvider,HashedPassword,IsSystemUser,IsEmployee,IsSalesperson,UserPreferences,PhoneNumber,FaxNumber,EmailAddress,Photo,CustomFields,OtherLanguages,LastEditedBy,ValidFrom,ValidTo")] Person person) { if (ModelState.IsValid) { db.People.Add(person); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LastEditedBy = new SelectList(db.People, "PersonID", "FullName", person.LastEditedBy); return(View(person)); }
public OrderLines UpdateOrderLines(OrderLines orderLines) { if (orderLines != null) { OrderLines orderLinesUpd = _DbModelEntities.OrderLines.FirstOrDefault(p => p.OrderLineID.Equals(orderLines.OrderLineID)); if (orderLinesUpd != null) { orderLinesUpd.Description = orderLines.Description; orderLinesUpd.PackageTypeID = orderLines.PackageTypeID; orderLinesUpd.Quantity = orderLines.Quantity; orderLinesUpd.UnitPrice = orderLines.UnitPrice; orderLinesUpd.TaxRate = orderLines.TaxRate; orderLinesUpd.PickedQuantity = orderLines.PickedQuantity; } else { return(null); } _DbModelEntities.SaveChanges(); return(orderLinesUpd); } return(null); }
public void UpdatePeople(Person person) { var _People = dbContext.People.Find(person.PersonID); TryUpdateModel(_People); if (ModelState.IsValid) { dbContext.SaveChanges(); } }
public AddUpdateItemResponse UpdatestockItem(StockItemDTO item) { try { using (WideWorldImportersEntities entities = new WideWorldImportersEntities()) { var originalItem = entities.StockItems.FirstOrDefault(s => s.StockItemID == item.StockItemID); originalItem.Barcode = item.Barcode; originalItem.Brand = item.Brand; originalItem.ColorID = item.ColorID; originalItem.CustomFields = item.CustomFields; originalItem.InternalComments = item.InternalComments; originalItem.IsChillerStock = item.IsChillerStock; originalItem.LastEditedBy = item.LastEditedBy; originalItem.LeadTimeDays = item.LeadTimeDays; originalItem.MarketingComments = item.MarketingComments; originalItem.OuterPackageID = item.OuterPackageID; originalItem.Photo = item.Photo; originalItem.QuantityPerOuter = item.QuantityPerOuter; originalItem.RecommendedRetailPrice = item.RecommendedRetailPrice; originalItem.SearchDetails = item.SearchDetails; originalItem.Size = item.Size; originalItem.StockItemName = item.StockItemName; originalItem.SupplierID = item.SupplierID; originalItem.Tags = item.Tags; originalItem.TaxRate = item.TaxRate; originalItem.TypicalWeightPerUnit = item.TypicalWeightPerUnit; originalItem.UnitPackageID = item.UnitPackageID; originalItem.UnitPrice = item.UnitPrice; originalItem.ValidFrom = item.ValidFrom; originalItem.ValidTo = item.ValidTo; //entities.Entry(originalItem).State = System.Data.Entity.EntityState.Modified; entities.SaveChanges(); return(new AddUpdateItemResponse() { ItemId = originalItem.StockItemID, ErrorMessage = "", Success = true }); } } catch (Exception ex) { return(new AddUpdateItemResponse() { ItemId = item.StockItemID, ErrorMessage = ex.ToString(), Success = false }); } }