コード例 #1
0
        public DbResponse Edit(AccountCrudModel model)
        {
            var account = Context.Account.Find(model.AccountId);

            account.AccountName    = model.AccountName;
            account.CostPercentage = model.CostPercentage;
            Context.Account.Update(account);
            Context.SaveChanges();
            return(new DbResponse(true, $"{account.AccountName} Updated Successfully"));
        }
コード例 #2
0
        public DbResponse <AccountCrudModel> Add(AccountCrudModel model)
        {
            var account = _mapper.Map <Account>(model);

            Context.Account.Add(account);
            Context.SaveChanges();
            model.AccountId = account.AccountId;

            return(new DbResponse <AccountCrudModel>(true, $"{model.AccountName} Added Successfully", model));
        }