예제 #1
0
        public HttpResponseMessage DeleteFaculty(string deleteByCode)
        {
            try
            {
                int i = facultyRepository.DeleteFaculty(deleteByCode);

                if (i > 0)
                {
                    HttpResponseMessage hrm = new HttpResponseMessage(HttpStatusCode.NoContent)
                    {
                    };
                    return(hrm);
                }
                HttpResponseMessage hr = new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                };
                return(hr);
            }
            catch (Exception ex)
            {
                Errors errors          = ErrorsHelper.GetErrors(ex);
                HttpResponseMessage hr = new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent(errors.ToString())
                };
                return(hr);
            }
        }
예제 #2
0
        public IActionResult Delete(int id)
        {
            _facultyRepository.DeleteFaculty(id);

            _logger.LogInformation($"Delete faculty with id: {id}!");
            return(RedirectToAction("Index"));
        }
예제 #3
0
        public async Task <IActionResult> Delete(int?id)
        {
            if (!await facultyRepository.DeleteFaculty(id))
            {
                return(NotFound());
            }

            return(RedirectToAction(nameof(Index)));
        }
        public RedirectToActionResult DeleteFaculty(int fid)
        {
            FacultyResponse deleteFaculty = repository.DeleteFaculty(fid);

            if (deleteFaculty != null)
            {
                TempData["message"] = $"{deleteFaculty.fName} has been deleted!";
            }
            return(RedirectToAction("ViewFaculty"));
        }
예제 #5
0
 public HttpResponseMessage DeleteFaculty(string facultyCode)
 {
     try
     {
         int i = facultyRepository.DeleteFaculty(facultyCode);
         return(Request.CreateResponse(HttpStatusCode.NoContent));
     }
     catch (Exception ex)
     {
         Errors errors = ErrorsHelper.GetErrors(ex);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, errors));
     }
 }
 public IActionResult DeleteFaculty(string facultyCode)
 {
     try
     {
         int i = facultyRepository.DeleteFaculty(facultyCode);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Errors errors = ErrorsHelper.GetErrors(ex);
         return(StatusCode(StatusCodes.Status500InternalServerError, errors));
     }
 }
 public IActionResult DFaculty(Faculty faculty)
 {
     fRepository.DeleteFaculty(faculty.FacultyCode);
     TempData["message"] = $"{faculty.FacultyName} was deleted";
     return(RedirectToAction("Faculty"));
 }
예제 #8
0
 private void DeleteFaculty(string path, int id)
 {
     _facRep.DeleteFaculty(id);
     _fileRep.DeleteFolder(Path.Combine(StoragePath, path, id.ToString()));
 }
예제 #9
0
        public ActionResult Delete(int Id)
        {
            _facultyRepository.DeleteFaculty(Id);

            return(RedirectToAction("Index"));
        }