public ActionResult Delete(int id, PositionViewModel collection) { try { if (id > 0) { collection.UpdaterId = LogedInAdmin.Id; _positionService.Delete(_mapper.Map <Position>(collection)); return(RedirectToAction("Index")); } ModelState.AddModelError(string.Empty, GeneralMessages.EmptyId); return(View(collection)); } catch (Exception ex) { _logger.Error(ex); if (ex.InnerException != null && ex.InnerException.Source.Equals(GeneralMessages.ExceptionSource)) { ModelState.AddModelError(string.Empty, ex.Message); } else { ModelState.AddModelError(string.Empty, GeneralMessages.UnexpectedError); } return(View(collection)); } }
public async Task <ActionResult <Position_PositionDTO> > Delete([FromBody] Position_PositionDTO Position_PositionDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } if (!await HasPermission(Position_PositionDTO.Id)) { return(Forbid()); } Position Position = ConvertDTOToEntity(Position_PositionDTO); Position = await PositionService.Delete(Position); Position_PositionDTO = new Position_PositionDTO(Position); if (Position.IsValidated) { return(Position_PositionDTO); } else { return(BadRequest(Position_PositionDTO)); } }
public IHttpActionResult SoftDelete(int id) { try { _positionService.Delete(id, DeleteState.SoftDelete); } catch (LogicalException ex) { return(BadRequest(ex.Message)); } catch { return(BadRequest(AppSettings.INTERNAL_SERVER_ERROR_MESSAGE)); } return(Ok()); }
public IHttpActionResult Delete(EmployeeInPositionVM m) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _servicePosition.Delete(m.Id); return(Ok()); }
public IActionResult Delete([FromQuery] PositionDTO dto) { var result = _positionService.Delete(dto); if (!result) { return(Ok(false)); } return(Ok(true)); }
public HttpResponseMessage Delete(HttpRequestMessage request, int PositionID) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (ModelState.IsValid) { request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } else { _positionService.Delete(PositionID); _positionService.Save(); response = request.CreateResponse(HttpStatusCode.OK); } return response; })); }
public async Task <ActionResult> DeletePosition(int Id) { if (Id <= 0) { return(BadRequest("Id no econtrado")); } var result = await _Service.Delete(Id); return (Ok(result)); }
public async Task <IActionResult> DeletePosition(int id) { var hasPermission = await _accessManager.HasPermission(User.Identity.Name, _adminSubsystemName); if (hasPermission) { _positionService.Delete(id); return(RedirectToAction("Index", "Admin")); } return(Forbid(CookieAuthenticationDefaults.AuthenticationScheme)); }
public ActionResult PositionDelete(Position position) { //var position = _positionService.GetPositionDetails().Where(model => model.PositionId == PositionId).SingleOrDefault(); if (position != null && ModelState.IsValid) { _positionService.Delete(position); return(Json(1)); } else { return(Json(-1)); } }
private void DeletePositionButton_Click(object sender, RoutedEventArgs e) { if (PositionIdTextBox == null) { MessageBox.Show("Please Select a Position Id"); } else { var Id = Convert.ToInt16(PositionIdTextBox.Text); _positionService.Delete(Id); MessageBox.Show("Delete Sucess"); PositionNameTextBox.Text = ""; } RefreshPosition(); }
public void Delete(long id) { var car = dataStore.Get <Car>(id); if (car == null) { throw new EntityNotFoundException($"Запись типа {typeof(Car).Name} c идентификатором {id} не существует"); } if (car.PositionId != null) { positionService.Delete(car.PositionId.Value); } dataStore.Delete(car); }
public ActionResult Delete(Guid id) { try { _positionService.Delete(id); } catch (NotFoundException) { return(HttpNotFound()); } catch (HasRelationsException) { return(Content("Удаление невозможно.")); } return(RedirectToAction("Index")); }
public async Task <IActionResult> Delete(int id) { bool result = true; try { await _positionService.Delete(id); return(Json(true)); } catch (Exception) { result = false; return(Json(result)); } }
public IActionResult Delete(int id) { if (id == 0) { return(this.BadRequest("Id can not be 0")); } try { service.Delete(id); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Delete(TRequest <int> request) { var response = new Response <object>(); try { response.Data = await _positionService.Delete(request.value); response.Success = true; } catch (Exception ex) { response.Success = false; response.Message = ex.Message + "," + ex.InnerException; } return(Ok(response)); }
public IActionResult Delete(int id) { if (id == 0) { return(this.BadRequest()); } try { service.Delete(id); ShowNotification(SuccessMessages.SuccesslDelete, ToastrSeverity.Success); return(RedirectToAction("All", null)); } catch (Exception ex) { ShowNotification(ex.Message, ToastrSeverity.Error); return(RedirectToAction("All", null)); } }
public ActionResult Delete(int id) { //如果下面存在Tech则不能删除。 int posCount = UserInfoService.LoadEntities(u => u.PositionId == id).Count(); if (posCount > 0) { return(Content("必须先删除下面的所有使用后方可删除!")); } else { var entity = PositionService.LoadEntities(t => t.Id == id).FirstOrDefault(); if (entity != null) { PositionService.Delete(entity); } return(Content("ok")); } }
public IHttpActionResult Deleteposition(int positionId) { ResponseDataDTO <position> response = new ResponseDataDTO <position>(); try { var positionDeleted = _positionservice.Find(positionId); if (positionDeleted != null) { _positionservice.Delete(positionDeleted); // return response response.Code = HttpCode.OK; response.Message = MessageResponse.SUCCESS; response.Data = null; return(Ok(response)); } else { // return response response.Code = HttpCode.NOT_FOUND; response.Message = MessageResponse.FAIL; response.Data = null; return(Ok(response)); } } catch (Exception ex) { response.Code = HttpCode.INTERNAL_SERVER_ERROR; response.Message = ex.Message; response.Data = null; Console.WriteLine(ex.ToString()); return(Ok(response)); } }
public IActionResult Delete(int id) { _positionService.Delete(id); return(Ok()); }
public string Delete(int id) { return(_oPositionService.Delete(id)); }
public async Task <IResultModel> Delete([BindRequired] Guid id) { return(await _service.Delete(id)); }
public async Task <IActionResult> Delete(int id) { await _positionService.Delete(id); return(new OkObjectResult(true)); }
public BaseResponse <bool> Delete(Guid id) { return(_positionService.Delete(id)); }
public async Task <ResponseModel> Delete([FromBody] PositionModel model) { var response = await _positionService.Delete(model); return(response); }
public Task <IResultModel> Delete([BindRequired] int id) { return(_service.Delete(id)); }
public ActionResult DeleteConfirmed(int id) { _positionService.Delete(id); return(RedirectToAction("Index")); }
// DELETE: api/Position/5 public void Delete(int id) { _positionService.Delete(id); }
public void DeletePosition(int id) { service.Delete(id); }