public async Task <MasterKeyValue> AddMaster(MasterKeyValueViewModel masterKeyValueVM) { var mstKeyVal = mapper.Map <MasterKeyValueViewModel, MasterKeyValue>(masterKeyValueVM); _unitOfWork.MasterKeyValues.Add(mstKeyVal); await _unitOfWork.CompleteAsync(); return(await Task.FromResult(mstKeyVal)); }
public async Task <MasterKeyValue> EditMaster(MasterKeyValueViewModel masterKeyValueVM) { MasterKeyValue mstKeyVal = new MasterKeyValue(); try { var origionalData = _unitOfWork.MasterKeyValues.GetSingleOrDefault(m => m.Id == masterKeyValueVM.Id); if (origionalData != null) { mstKeyVal = mapper.Map <MasterKeyValueViewModel, MasterKeyValue>(masterKeyValueVM); _unitOfWork.MasterKeyValues.Update(origionalData, mstKeyVal); await _unitOfWork.CompleteAsync(); } } catch (Exception Ex) { throw Ex; } return(await Task.FromResult(mstKeyVal)); }