Beispiel #1
0
 public ActionResult DeleteSpecialty(int id, int facultyId)
 {
     if (id != 0)
     {
         string temp = _specialty.GetById(id).Photo;
         if (temp != null)
         {
             System.IO.File.Delete(Server.MapPath(temp));
         }
         _specialty.Delete(id);
     }
     return(RedirectToAction("Specialties", new { facultyId = facultyId }));
 }
Beispiel #2
0
 public ActionResult Delete(long id)
 {
     if (!ModelState.IsValid)
     {
         return(RedirectToAction("Index", "Error"));
     }
     _specialtyService.Delete(id);
     _historyService.Insert(new History
     {
         Email    = AuthHelper.GetUser(HttpContext).Email,
         Action   = Action.Delete,
         DateTime = DateTime.Now,
         Entity   = EntityEnum.Speciality
     });
     _unitOfWork.SaveChanges();
     return(RedirectToAction("Index"));
 }
Beispiel #3
0
        public IActionResult DeleteSpecialty(int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }

            var specialty = _specialtyService.GetSpecialtyById(id);

            _specialtyService.Delete(id);

            if (specialty == null)
            {
                return(NotFound());
            }

            return(Ok());
        }
Beispiel #4
0
        public async Task <IActionResult> DeleteSpecialty(int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }

            var specialty = await _specialtyService.GetSpecialtyById(id);

            if (specialty == null)
            {
                return(NotFound());
            }

            await _specialtyService.Delete(id);

            return(Ok());
        }