public IActionResult Delete(int key) { var model = _leadTypeRepo.Get(key); _leadTypeRepo.Remove(model); if (_uow.Commit(this.ModelState)) { if (!String.IsNullOrEmpty(model.Image)) { FileHelper.DeleteFile(Path.Combine(this.ImagePath, model.Image)); } return(Ok()); } else { return(BadRequest(GetFullErrorMessage(this.ModelState))); } }