public IActionResult GetById(int Id)
        {
            ResultModel resultModel = new ResultModel();
            var         noteData    = _treatmentRecordServices.GetNoteAndReportById(Id);
            var         model       = new NoteAndReportModel();

            model.Id = noteData.Id;
            model.IsTreatmentCompletedWOIncident = noteData.IsTreatmentCompletedWOIncident;
            model.TreatmentRecordMasterId        = noteData.TreatmentRecordMasterId;
            model.ReportGivenTo = noteData.ReportGivenTo;
            model.LastUpdated   = noteData.LastUpdated;
            model.Note          = noteData.Note;
            model.CreatedOn     = noteData.CreatedOn;
            model.Deleted       = noteData.Deleted;
            if (model != null)
            {
                resultModel.Message  = ValidationMessages.Success;
                resultModel.Status   = 1;
                resultModel.Response = model;
                return(Ok(resultModel));
            }
            else
            {
                resultModel.Message  = ValidationMessages.Failure;
                resultModel.Status   = 0;
                resultModel.Response = null;
                return(Ok(resultModel));
            }
        }
        public IActionResult Create(NoteAndReportModel model)
        {
            ResultModel resultModel = new ResultModel();

            try {
                var notedata = new NoteAndReportMaster();
                if (model.Id == 0)
                {
                    notedata.Note          = model.Note;
                    notedata.ReportGivenTo = model.ReportGivenTo;
                    notedata.IsTreatmentCompletedWOIncident = model.IsTreatmentCompletedWOIncident;
                    notedata.TreatmentRecordMasterId        = model.TreatmentRecordMasterId;
                    notedata.MarkComplete = model.MarkComplete;
                    notedata.Deleted      = false;
                    notedata.CreatedOn    = DateTime.UtcNow;
                    _treatmentRecordServices.InsertNoteAndReport(notedata);
                    //Bhawana(09/10/2019)
                    //Change treatment Record Status
                    _reportService.UpdateTreatmentStatusID((int)notedata.TreatmentRecordMasterId);
                    //12/10/19 aakansha
                    //model response
                    model.TreatmentRecordMasterId = notedata.TreatmentRecordMasterId;
                    resultModel.Message           = ValidationMessages.Success;
                    resultModel.Status            = 1;
                    resultModel.Response          = model;
                }
                else
                {
                    notedata = _treatmentRecordServices.GetNoteAndReportById(model.Id);
                    notedata.ReportGivenTo = model.ReportGivenTo;
                    notedata.IsTreatmentCompletedWOIncident = (bool)model.IsTreatmentCompletedWOIncident;
                    notedata.TreatmentRecordMasterId        = model.TreatmentRecordMasterId;
                    notedata.MarkComplete = model.MarkComplete;
                    notedata.LastUpdated  = DateTime.UtcNow;
                    _treatmentRecordServices.UpdateNoteAndReport(notedata);
                    //Bhawana(09/10/2019)
                    //Change treatment Record Status
                    _reportService.UpdateTreatmentStatusID((int)notedata.TreatmentRecordMasterId);
                    //12/10/19 aakansha
                    //model response
                    model.Id = notedata.Id;
                    model.TreatmentRecordMasterId = notedata.TreatmentRecordMasterId;
                    resultModel.Message           = ValidationMessages.Success;
                    resultModel.Status            = 1;
                    resultModel.Response          = model;
                }
                return(Ok(resultModel));
            }
            catch (Exception e)
            {
                resultModel.Message  = ValidationMessages.Failure;
                resultModel.Status   = 0;
                resultModel.Response = null;
                return(Ok(resultModel));
            }
        }