public ActionResult Add(Models.SenServiceView collection) { try { int outputId = _dataobject.Insert(collection); return(Json(new { ketqua = "1" })); } catch (Exception ex) { return(Json(new { ketqua = "0", message = ex.Message })); } }
public ActionResult Edit(int ServiceId, Models.SenServiceView 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.SenServiceView data) { try { this.Validate(data); var _data = new Models.SenService(); MapView2Table(data, _data); this._db.SenServices.Add(_data); this._db.SaveChanges(); return(_data.ServiceId); } catch (Exception) { throw; } }
public int Update(Models.SenServiceView data) { try { this.Validate(data); var _data = this.GetById2(data.ServiceId); MapView2Table(data, _data); this._db.Entry(_data).State = System.Data.Entity.EntityState.Modified; this._db.SaveChanges(); return(_data.ServiceId); } catch (Exception) { throw; } }