public async Task <InteractionResponseModel> UpdateInteraction(InteractionUpdateRequestModel interactionUpdateRequestModel, int id) { var dbInteraction = await _interactionsRepository.GetByIdAsync(id); if (dbInteraction == null) { throw new Exception("No Client Exist"); } var interaction = new Interactions { Id = dbInteraction.Id, ClientId = interactionUpdateRequestModel.ClientId == 0 ? dbInteraction.ClientId : interactionUpdateRequestModel.ClientId, EmpId = interactionUpdateRequestModel.EmpId == 0 ? dbInteraction.EmpId : interactionUpdateRequestModel.EmpId, IntType = interactionUpdateRequestModel.type == 0 ? dbInteraction.IntType : interactionUpdateRequestModel.type, IntDate = interactionUpdateRequestModel.Date == null ? dbInteraction.IntDate : interactionUpdateRequestModel.Date, Remarks = interactionUpdateRequestModel.Remarks == null ? dbInteraction.Remarks : interactionUpdateRequestModel.Remarks, }; var updatedInteraction = await _interactionsRepository.UpdateAsync(interaction); var response = new InteractionResponseModel { Id = updatedInteraction.Id, ClientId = updatedInteraction.ClientId, EmpId = updatedInteraction.EmpId, type = updatedInteraction.IntType, Date = updatedInteraction.IntDate, Remarks = updatedInteraction.Remarks, }; return(response); }
public async Task <Interactions> UpdateInteractions(Interactions interactions) { var ints = await _interactionsRepository.UpdateAsync(interactions); return(ints); }