public async Task <ICommandResult> Handle(EditCallTypeCommand command) { CallType callType = await _CallTypeRepository.GetById(command.Id); if (callType == null) { return(new CommandResult(false, Messages.Account_NOT_FOUND, null)); } NameOrDescription name = new NameOrDescription(command.Name); callType.Update(name, command.UpdatedByUserId); AddNotifications(name.Notifications); AddNotifications(callType.Notifications); if (!Valid) { return(new CommandResult( false, Messages.NOTIFICATIONS, Notifications)); } await _CallTypeRepository.Update(callType); return(new CommandResult( true, Messages.UPDATED_WITH_SUCCESS, new CallTypeCommandResult { Id = callType.Id, Name = callType.Name.Name, CreatedDate = callType.Audit.CreatedDateBy.CreatedDate, CreatedByUserId = callType.Audit.CreatedDateBy.CreatedByUserId, UpdatedDate = callType.Audit.UpdatedDateBy.UpdatedDate, UpdatedByUserId = callType.Audit.UpdatedDateBy.UpdatedByUserId, CompanyId = callType.Audit.CompanyAndBranchOffice.CompanyId, BranchOfficeId = callType.Audit.CompanyAndBranchOffice.BranchOfficeId })); }
private bool SaveData() { if (!IsValidate()) { popupCallType.Show(); return(false); } string Message = string.Empty; var objCallType = new CallType() { FirmId = lblFirmId.zToInt(), CallTypeName = txtCallTypeName.Text.Trim().zFirstCharToUpper(), SMSText = txtSMSText.Text, IsSendSMS = chkSendSMS.Checked ? (int)eYesNo.Yes : (int)eYesNo.No }; if (IsEditMode()) { objCallType.CallTypeId = lblCallTypeId.zToInt(); objCallType.Update(); Message = "CallType Detail Change Sucessfully."; } else { objCallType.eStatus = (int)eStatus.Active; objCallType.Insert(); Message = "New CallType Added Sucessfully."; } CU.ZMessage(eMsgType.Success, string.Empty, Message); return(true); }