public async Task <AddCounsellingResponse> AddCounselling(AddPrePNDTCounsellingRequest acData) { var sResponse = new AddCounsellingResponse(); try { //var extension = ""; // var fileNames = ""; // var fullPath = ""; // if (acData.isPNDTAgreeYes == true) // { // if (formFile.FileName != null || formFile.FileName != "") // { // extension = "." + formFile.FileName.Split('.')[formFile.FileName.Split('.').Length - 1]; // fileNames = DateTime.Now.Ticks + "_" + formFile.FileName; //Create a new Name for the file due to security reasons. // if (formFile.Length > 0) // { // // full path to file in location // var filePath = Path.Combine(Directory.GetCurrentDirectory(), "PrePNDTForm"); // if (!Directory.Exists(filePath)) // { // Directory.CreateDirectory(filePath); // } // using (var stream = new FileStream(fullPath, FileMode.Create)) // { // formFile.CopyTo(stream); // } // } // } // else // { // sResponse.Status = "false"; // sResponse.Message = $"File is missing"; // return sResponse; // } // } var schedulingDateTime = _pndtData.AddCounselling(acData); sResponse.Status = "true"; sResponse.Message = string.Empty; sResponse.data = schedulingDateTime; return(sResponse); } catch (Exception e) { sResponse.Status = "false"; sResponse.Message = $"Unable to add counselling - {e.Message}"; return(sResponse); } }
public async Task <IActionResult> AddCounselling(AddPrePNDTCounsellingRequest acData) { try { _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}"); // IFormFile file = HttpContext.Request.Form.Files[0]; var counselling = await _pndtService.AddCounselling(acData); _logger.LogInformation($"Add counselling for positive subjects for PNDT - {counselling}"); return(Ok(new AddCounsellingResponse { Status = counselling.Status, Message = counselling.Message, data = counselling.data, })); } catch (Exception ex) { throw ex; } }
public PrePNDTScheduleDateTime AddCounselling(AddPrePNDTCounsellingRequest acData) { string stProc = AddPrePNDTCounselling; var pList = new List <SqlParameter>() { new SqlParameter("@PrePNDTSchedulingId", acData.prePNDTSchedulingId), new SqlParameter("@ANWSubjectId", acData.anwsubjectId ?? acData.anwsubjectId), new SqlParameter("@SpouseSubjectId", acData.spouseSubjectId ?? acData.spouseSubjectId), new SqlParameter("@CounsellingRemarks", acData.counsellingRemarks ?? acData.counsellingRemarks), new SqlParameter("@AssignedObstetricianId", acData.assignedObstetricianId), new SqlParameter("@CounsellorId", acData.counsellorId), new SqlParameter("@IsPNDTAgreeYes", acData.isPNDTAgreeYes), new SqlParameter("@IsPNDTAgreeNo", acData.isPNDTAgreeNo), new SqlParameter("@IsPNDTAgreePending", acData.isPNDTAgreePending), new SqlParameter("@SchedulePNDTDate", acData.schedulePNDTDate ?? acData.schedulePNDTDate), new SqlParameter("@SchedulePNDTtime", acData.schedulePNDTTime ?? acData.schedulePNDTTime), new SqlParameter("@FileName", acData.fileName.ToCheckNull()), new SqlParameter("@FileLocation", acData.fileLocation.ToCheckNull()), new SqlParameter("@CreatedBy", acData.userId), }; var schedulingData = UtilityDL.FillEntity <PrePNDTScheduleDateTime>(stProc, pList); return(schedulingData); }