public ActionResult Edit(int CustomerId, Models.SenCustomer collection) { try { int outputId = _dataobject.Update(collection); return(RedirectToAction(this.ActionReturn())); } catch (Exception ex) { Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex); return(PartialView(this._updateview, collection)); } }
public int Insert(Models.SenCustomer data) { try { this.Validate(data); data.CreatedDateTime = DateTime.Now; this._db.SenCustomers.Add(data); this._db.SaveChanges(); return(0); } catch (Exception) { throw; } }
public int Update(Models.SenCustomer data) { try { this.Validate(data); var _data = this.GetById(data.CustomerId); data.CreatedDateTime = _data.CreatedDateTime; data.ModifiedDateTime = DateTime.Now; this._db.Entry(_data).State = System.Data.Entity.EntityState.Detached; //this._db.SaveChanges(); this._db.Entry(data).State = System.Data.Entity.EntityState.Modified; this._db.SaveChanges(); return(data.CustomerId); } catch (Exception) { throw; } }