public Guid UpdateByUser(Models.SenUserView data) { try { if (data.UserId == Guid.Empty) { data.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); } this.Validate(data); if (this.IsExist(data.UserId)) { var _data = this.GetById2(data.UserId); this.MapView2Table(data, _data); this._db.Entry(data).State = System.Data.Entity.EntityState.Modified; this._db.SaveChanges(); return(data.UserId); } else { return(this.InsertByUser(data)); } } catch (Exception) { throw; } }
public Models.SenUserView GetEdit(Guid id) { var model = GetById(id); if (model == null) { model = new Models.SenUserView(); } return(model); }
public ActionResult Edit(int SenUserId, Models.SenUserView 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.SenUserView data) { try { this.Validate(data); var _data = new Models.SenUser(); this.MapView2Table(data, _data); this._db.SenUsers.Add(_data); this._db.SaveChanges(); return(data.SenUserId); } catch (Exception) { throw; } }
public Guid InsertByUser(Models.SenUserView data) { try { this.Validate(data); data.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); var _data = new Models.SenUser(); this.MapView2Table(data, _data); this._db.SenUsers.Add(_data); this._db.SaveChanges(); return(data.UserId); } catch (Exception) { throw; } }
public int Update(Models.SenUserView data) { try { this.Validate(data); var _data = this.GetById2(data.SenUserId); this.MapView2Table(data, _data); this._db.Entry(_data).State = System.Data.Entity.EntityState.Modified; this._db.SaveChanges(); return(data.SenUserId); } catch (Exception) { throw; } }