/// <summary> /// Delete Tax value by Id /// </summary> /// <param name="id">ID of Tax value</param> /// <returns></returns> public ApiResponseViewModel Delete(int id) { var result = new Model.Models.Type(); var response = new ApiResponseViewModel { Code = CommonConstants.ApiResponseSuccessCode, Message = null, Result = null }; try { var exists = _TypeRepository.CheckContains(m => m.ID == id); if (exists) { result = _TypeRepository.Delete(id); _unitOfWork.Commit(); response.Message = CommonConstants.DeleteSuccess; response.Result = result; } else { response.Code = CommonConstants.ApiResponseNotFoundCode; response.Message = CommonConstants.NotFoundMessage; } } catch (Exception ex) { response.Code = CommonConstants.ApiResponseExceptionCode; response.Message = CommonConstants.ErrorMessage + " " + ex.Message; } return(response); }
public async Task <IActionResult> Delete(int typeId) { try { await _typeRepository.Delete(typeId); return(Ok(NotificationMessage.TypeDeleteSuccess)); } catch (Exception ex) { _log.LogError(ex.ToString()); return(BadRequest(ex.ToString())); } }
public ActionResult Delete(int id) { // Usuń typ z repozytorium var response = _repository.Delete(id); // Sprawdź status operacji if (!response.Accepted) { foreach (var err in response.Errors) { Error(err.Message); } } return(RedirectToAction("Index", "Default", new { ctr = "MultimediaTypes" })); }
public async Task <Models.DTO.Type> Delete( string id, string tenantId, CancellationToken cancellationToken) { if (!ObjectId.TryParse(id, out var typeId)) { throw new ArgumentException("Invalid Id, cannot cast to ObjectId."); } var deletedDevice = await _typeRepository.Delete( typeId, tenantId, cancellationToken); return(TypeMapper.MapToDto(deletedDevice)); }
public async Task <bool> Delete(User user, Type type) { try { var realType = await GetById(user, type.Id); if (realType != null && realType.fk_UserId == user.Id) { type.fk_UserId = user.Id; type.Deleted = true; type.DeletedOn = DateTime.Today; return(_typeRepository.Delete(type)); } return(false); } catch (Exception ex) { throw; } }
public void Delete(int typeId) { var type = GetById(typeId); _typeRepository.Delete(type); }
public void deleteType(int id) { Data.Type Type = TypeRepository.GetById(id); TypeRepository.Delete(Type); SaveChange(); }
public IActionResult Delete([FromBody] Type type) { _repository.Delete(type); return(new JsonResult(new { delete = true })); }
public bool Delete(int id) { return(iTypeRepository.Delete(id)); }
public Type Delete(int id) { return(_typeRepository.Delete(id)); }
public IActionResult DeleteType([FromRoute] Guid id) { _typeRepository.Delete(id); return(new OkResult()); }
public Type DeleteType(int id) { return(_typeRepo.Delete(id)); }