Example #1
0
 public IActionResult AddEditHospital(long?id, HospitalViewModel model)
 {
     if (id.HasValue && id.Value != 0)
     {
         //
         var hospital = _hospitalService.GetHospitalbyId(id.Value).SingleOrDefault();
         if (hospital != null)
         {
             hospital.HospitalName        = model.HospitalName;
             hospital.Host                = model.Host;
             hospital.HospitalAddress     = model.HospitalAddress;
             hospital.HospitalPhoneNumber = model.HospitalPhoneNumber;
             hospital.SecureUrl           = model.SecureUrl;
             hospital.SslEnabled          = model.SslEnabled;
             hospital.Url = model.Url;
             _hospitalService.UpdateHospital(hospital);
         }
     }
     else
     {
         var hospital = new Hospital();
         hospital.HospitalName        = model.HospitalName;
         hospital.Host                = model.Host;
         hospital.HospitalAddress     = model.HospitalAddress;
         hospital.HospitalPhoneNumber = model.HospitalPhoneNumber;
         hospital.SecureUrl           = model.SecureUrl;
         hospital.SslEnabled          = model.SslEnabled;
         hospital.Url = model.Url;
         _hospitalService.AddHospital(hospital);
     }
     return(RedirectToAction("Index"));
 }
Example #2
0
        public IActionResult AddHospital(Hospital hospital)
        {
            if (hospital == null)
            {
                return(BadRequest());
            }
            var re = _IHospitalService.AddHospital(hospital);

            return(Ok(re));
        }
Example #3
0
 public void Post([FromBody] Hospital hospital)
 {
     _hospitalService.AddHospital(hospital);
 }