Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
        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()));
            }
        }
Beispiel #3
0
        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" }));
        }
Beispiel #4
0
        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;
            }
        }
Beispiel #6
0
        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 }));
 }
Beispiel #9
0
 public bool Delete(int id)
 {
     return(iTypeRepository.Delete(id));
 }
Beispiel #10
0
 public Type Delete(int id)
 {
     return(_typeRepository.Delete(id));
 }
Beispiel #11
0
 public IActionResult DeleteType([FromRoute] Guid id)
 {
     _typeRepository.Delete(id);
     return(new OkResult());
 }
Beispiel #12
0
 public Type DeleteType(int id)
 {
     return(_typeRepo.Delete(id));
 }