public ActionResult tblProperties_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")] IEnumerable <PropertyVM> tblproperties) { //ModelState["TransDate"].Errors.Clear(); //&& ModelState.IsValid var entities = new List <tblProperty>(); if (tblproperties != null) { foreach (var c in tblproperties) { var entity = db.tblProperties.Find(c.PropertyID); entity.PropertyTitle = c.PropertyTitle; entity.Purpose = c.Purpose; entity.TypeID = c.TypeID; entity.CityID = c.CityID; entity.SocietyID = c.SocietyID; entity.Description = c.Description; entity.Price = c.Price; entity.LandArea = c.LandArea; entity.UOMID = c.UOMID; entity.Status = c.Status; entity.IsFeatured = c.IsFeatured; entity.Block = c.Block; entity.ContactNo = c.ContactNo; entity.Estate = c.Estate; entity.IsDealer = c.IsDealer; entity.Owner = c.Owner; entity.PlotNo = c.PlotNo; entities.Add(entity); db.tblProperties.Attach(entity); db.Entry(entity).State = EntityState.Modified; } db.SaveChanges(); } return(Json(entities.ToDataSourceResult(request, ModelState, tblProperty => new PropertyVM { PropertyTitle = tblProperty.PropertyTitle, Purpose = tblProperty.Purpose, Description = tblProperty.Description, Price = tblProperty.Price, LandArea = tblProperty.LandArea, TransDate = tblProperty.TransDate, Status = tblProperty.Status, IsFeatured = tblProperty.IsFeatured, CityID = tblProperty.CityID, PropertyID = tblProperty.PropertyID, SocietyID = tblProperty.SocietyID, TypeID = tblProperty.TypeID, UOMID = tblProperty.UOMID, UserID = tblProperty.UserID, Block = tblProperty.Block, ContactNo = tblProperty.ContactNo, Estate = tblProperty.Estate, IsDealer = tblProperty.IsDealer, Owner = tblProperty.Owner, PlotNo = tblProperty.PlotNo, User = tblProperty.tblUser.FullName }))); }
public ActionResult Edit([Bind(Include = "ID_City,City_Name,CreateBy,UpdateBy,CreateDate,UpdateDate,Status")] tbl_City tbl_City) { if (ModelState.IsValid) { tbl_City.UpdateDate = DateTime.Now; db.Entry(tbl_City).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_City)); }
public ActionResult Edit([Bind(Include = "ID_Ward,Ward_Name,ID_District,CreateBy,UpdateBy,CreateDate,UpdateDate,Status")] tbl_Ward tbl_Ward) { if (ModelState.IsValid) { tbl_Ward.UpdateDate = DateTime.Now; db.Entry(tbl_Ward).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_District = new SelectList(db.tbl_District, "ID_District", "District_Name", tbl_Ward.ID_District); return(View(tbl_Ward)); }
public ActionResult Edit([Bind(Include = "ID_Account,Account_Name,Sex,Birthday,Address,Email,Phone,ID_Position,Account,Pass,CreateBy,UpdateBy,CreateDate,UpdateDate,Status,Avarta")] tbl_Account tbl_Account) { if (ModelState.IsValid) { tbl_Account.UpdateDate = DateTime.Now; db.Entry(tbl_Account).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_Position = new SelectList(db.tbl_Position, "ID_Position", "Position_Name", tbl_Account.ID_Position); return(View(tbl_Account)); }