Пример #1
0
        public JsonResult AddPatientVillage(VVillages location)
        {
            try
            {
                if (location.Villageid == 0 || location.Villageid == null)
                {
                    var addedvillage = _village.Add(new VVillages()
                    {
                        Village = location.Village,
                        Wardid  = location.Wardid
                    });

                    location.Villageid = addedvillage.ID;
                }

                if (location.Patientid == 0)
                {
                    return(Json(new { Result = "ERROR", Message = "Please Add Biodata First" }));
                }
                else
                {
                    //Update patient location
                    var village = _patient.AddPatientLocation(location.Patientid, location.Villageid.Value);
                    return(Json(new { Result = "OK", Records = village }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { Result = "ERROR", Message = ex.Message }));
            }
        }