コード例 #1
0
        public async Task <IActionResult> updateMerchantRequest([FromBody] ModifyMerchantRequestDto ModifyMerchantRequestDto)
        {
            try
            {
                await _MerchantRequestService.UpdateRequestDetails(ModifyMerchantRequestDto.RequestID, ModifyMerchantRequestDto.ApprovalStatus, ModifyMerchantRequestDto.Description, ModifyMerchantRequestDto.RequestAssignee, "");

                await _MerchantRequestDetailsService.InsertMerchantRequestDetails(ModifyMerchantRequestDto.RequestID, ModifyMerchantRequestDto.ApprovalStatus, ModifyMerchantRequestDto.Description, ModifyMerchantRequestDto.RequestAssignee);

                await _MerchantService.UpdateRequestDetails(ModifyMerchantRequestDto);

                if (ModifyMerchantRequestDto.ApprovalStatusdesc == "Approved")
                {
                    int Merchantid = await _MerchantAccountDetailsService.GetMerchantContractNumberDetails(ModifyMerchantRequestDto.MerchantID);

                    if (Merchantid > 0)
                    {
                        await _MerchantAccountDetailsService.UpdateMerchantContractNumberDetails(ModifyMerchantRequestDto.MerchantID, ModifyMerchantRequestDto.MerchantContractNumber);
                    }
                    else
                    {
                        await _MerchantAccountDetailsService.InsertMerchantContractNumberDetails(ModifyMerchantRequestDto.MerchantID, ModifyMerchantRequestDto.MerchantContractNumber);
                    }
                    var Merchantdetails = await _MerchantService.GetMerchantDetailswithid(ModifyMerchantRequestDto.MerchantID);

                    string strURL  = _configuration["LoginUrl:LoginURL"];
                    string Message = "<table width='100%'><tr><td> Dear " + ModifyMerchantRequestDto.MerchantName + ",</td></tr><tr><td style='padding: 10px 0 10px 0;'>This is to inform you that your Dunyana account is approved, Click <a href=" + strURL + " >here</a> to login Dunyana account.</td></tr><tr><td  style='padding: 10px 0 10px 0;'>  For any clarifications you may write us your queries at <a href='mailto:[email protected]' target='_blank' rel='noopener'>[email protected]</a> </td></tr><tr><td  style='padding: 15px 0 15px 0;'> Regards,<br /> Dunyana</td></tr></table>";
                    await _emailService.SendEmail(Merchantdetails.Email, "Dunyana Account Activation", Message);
                }
                return(Ok(new GenericResultDto <string> {
                    Result = "MerchantRequest successfully updated"
                }));
            }
            catch (Exception err)
            {
                return(BadRequest(new GenericResultDto <string> {
                    Result = err.Message
                }));
            }
        }