public ActionResult Edit(int id, Hospital hospital)
 {
     if (hospital != null)
     {
         if (!string.IsNullOrEmpty(hospital.hospitalName) || !string.IsNullOrWhiteSpace(hospital.hospitalName))
         {
             _hospitalService.Edit(hospital);
             _logger.LogInformation("The hospital was updated!");
         }
     }
     return(RedirectToAction(nameof(Index)));
 }
        public async Task <IActionResult> Edit(string id, HospitalEditInputModel hospitalEditInputModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(hospitalEditInputModel));
            }

            HospitalServiceModel hospitalServiceModel = AutoMapper.Mapper.Map <HospitalServiceModel>(hospitalEditInputModel);

            await hospitalService.Edit(id, hospitalServiceModel);

            return(Redirect("/Hospital/Details"));
        }
示例#3
0
        public async Task <IActionResult> Put(int id, [FromBody] HospitalModel param)
        {
            AssignModelState();
            param.Id = id;
            var result = await _hospitalService.Edit(param);

            if (result.Success)
            {
                return(Ok(result.Item));
            }


            return(BadRequest(result.Message));
        }