public EditContactResponseViewModel EditContact(EditContactRequestViewModel request) { EditContactModel editContactModel = Mapper .Map <EditContactRequestViewModel, EditContactModel>(request); AddResultBaseModel <int> flag = new AddResultBaseModel <int>() { IsSuccessed = false, Id = request.ContactId }; using (var transaction = this.Context.Database.BeginTransaction()) { try { flag = _editContactServiceBll.Edit(editContactModel); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw; } } return(new EditContactResponseViewModel() { IsSuccessed = flag.IsSuccessed, ContactId = flag.Id }); }
public async Task <ResponseBaseViewModel <EditContactResponseViewModel> > EditContact( [FromBody] EditContactRequestViewModel request) { request.Cid = this.GetCid(); EditContactResponseViewModel viewModel = new EditContactResponseViewModel(); await new TaskFactory().StartNew(() => { viewModel = _editContactApplication.EditContact(request); }); ResponseBaseViewModel <EditContactResponseViewModel> v = new ResponseBaseViewModel <EditContactResponseViewModel> { Flag = new ResponseCodeViewModel() { Code = 0, MojoryToken = this.GetToken() }, Data = viewModel }; return(v); }