示例#1
0
        /// <summary>
        /// Insert new AccountSubType item.
        /// </summary>
        /// <param name="model">The AccountSubType information value.</param>
        /// <returns></returns>
        public ResultViewModel Save(AccountSubTypeViewModel model)
        {
            var result = new ResultViewModel();

            using (TransactionScope scope = new TransactionScope())
            {
                var accountSubType = _mapper.Map <AccountSubTypeViewModel, AccountSubType>(model);
                _unitOfWork.GetRepository <AccountSubType>().Add(accountSubType);
                _unitOfWork.Complete(scope);
            }
            this.ReloadCacheAccountSubType();
            return(result);
        }
示例#2
0
        /// <summary>
        /// Update AccountSubType item.
        /// </summary>
        /// <param name="model">The AccountSubType information value.</param>
        /// <returns></returns>
        public ResultViewModel Edit(AccountSubTypeViewModel model)
        {
            var result = new ResultViewModel();

            using (TransactionScope scope = new TransactionScope())
            {
                var accountSubType = _unitOfWork.GetRepository <AccountSubType>().GetCache(x => x.Id == model.Id).FirstOrDefault();
                accountSubType.SubTypeName = model.SubTypeName;
                _unitOfWork.GetRepository <AccountSubType>().Update(accountSubType);
                _unitOfWork.Complete(scope);
            }
            this.ReloadCacheAccountSubType();
            return(result);
        }
 public IActionResult Edit([FromBody] AccountSubTypeViewModel model)
 {
     return(Ok(_accountSubType.Edit(model)));
 }