public int Insert(Models.SenUserCashView data) { try { this.Validate(data); data.CreateBy = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); data.CreateDate = DateTime.UtcNow; var _data = new Models.SenUserCash(); this.MapView2Table(data, _data); this._db.SenUserCashs.Add(_data); this._db.SaveChanges(); var senuserdataobject = new DAL.SenUser(this._request); senuserdataobject.UpdateCash(data.UserId ?? Guid.Empty); this.SenUserTransactionPost(_data.UserCashId); return(_data.UserCashId); } catch (Exception) { throw; } }
public ActionResult Edit(int UserCashId, Models.SenUserCashView 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 Update(Models.SenUserCashView data) { try { this.Validate(data); var _data = this.GetById2(data.UserCashId); this.MapView2Table(data, _data); this._db.Entry(_data).State = System.Data.Entity.EntityState.Modified; this._db.SaveChanges(); var senuserdataobject = new DAL.SenUser(this._request); senuserdataobject.UpdateCash(data.UserId ?? Guid.Empty); this.SenUserTransactionPost(data.UserCashId); return(data.UserCashId); } catch (Exception) { throw; } }