Exemple #1
0
        public ActionResult <GenericValidator> EditArtBaseline([FromBody] ArtBaselineModel adultArtBaseline)
        {
            var gVal = new GenericValidator();

            try
            {
                if (string.IsNullOrEmpty(adultArtBaseline.EnrolmentId))
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide ArtBaseline's enrolmentId.";
                    return(gVal);
                }
                if (adultArtBaseline.PatientId < 1)
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please Select a Patient";
                    return(gVal);
                }
                if (adultArtBaseline.EnrolmentDate == null)
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide Art Enrolment Date";
                    return(gVal);
                }
                if (adultArtBaseline.Id < 1)
                {
                    gVal.Code    = -1;
                    gVal.Message = "Invalid ArtBaseline information selected. Please try again.";
                    return(gVal);
                }

                var status = _adultArtBaselineService.UpdateArtBaseline(adultArtBaseline);
                if (status < 1)
                {
                    gVal.Code    = -1;
                    gVal.Message = "An unknown error was encountered. Please try again.";
                    return(gVal);
                }

                gVal.Code    = 5;
                gVal.Message = "ArtBaseline information was successfully Updated";
                return(gVal);
            }
            catch (Exception ex)
            {
                gVal.Code    = -1;
                gVal.Message = ex.Message != null ? ex.Message : ex.InnerException != null ? ex.InnerException.Message : "An unknown error was encountered. Please try again.";
                return(gVal);
            }
        }
Exemple #2
0
        public ActionResult <GenericValidator> AddArtBaseline([FromBody] ArtBaselineModel adultArtBaseline)
        {
            var gVal = new GenericValidator();

            try
            {
                if (adultArtBaseline.PatientId < 1)
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide select Patient.";
                    return(gVal);
                }
                if (adultArtBaseline.EnrolmentDate == null)
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide Art Enrolment Date";
                    return(gVal);
                }
                var status = _adultArtBaselineService.AddArtBaseline(adultArtBaseline);
                if (status < 1)
                {
                    gVal.Code    = -1;
                    gVal.Message = "An unknown error was encountered. Please try again.";
                    return(gVal);
                }

                gVal.Code    = status;
                gVal.Message = "ArtBaseline information was successfully Added";
                return(gVal);
            }
            catch (Exception ex)
            {
                gVal.Code    = -1;
                gVal.Message = ex.Message != null? ex.Message : ex.InnerException != null? ex.InnerException.Message : "An unknown error was encountered. Please try again.";
                return(gVal);
            }
        }