public HttpResponseMessage DeleteAddress(AddressModel model)
 {
     try
     {
         if (model.AddressId > 0)
         {
             var result = _repository.DeleteAddress(model.AddressId);
             if (result.isSuccess == true)
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, new { result }));
             }
             else
             {
                 return(Request.CreateResponse(HttpStatusCode.BadRequest, new { result }));
             }
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Something Worng !"));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Something Worng !", ex));
     }
 }
        public IActionResult Delete([FromBody] Models.Address value)
        {
            try
            {
                bool dt     = Address.DeleteAddress(value);
                var  resval = dt ? StatusCode(StatusCodes.Status200OK) : StatusCode(StatusCodes.Status204NoContent);
                return(resval);
            }
            catch (Helper.RepositoryException ex)
            {
                switch (ex.Type)
                {
                case UpdateResultType.SQLERROR:
                    return(StatusCode(StatusCodes.Status500InternalServerError, "Internal Server Error"));

                case UpdateResultType.INVALIDEARGUMENT:
                    return(StatusCode(StatusCodes.Status409Conflict, "Conflict"));

                case UpdateResultType.ERROR:
                    return(StatusCode(StatusCodes.Status400BadRequest, "Bad Request"));

                default:
                    return(StatusCode(StatusCodes.Status406NotAcceptable, "Not Acceptable"));
                }
            }
        }
Esempio n. 3
0
        public async Task <ActionResult <AddressDTO> > DeleteAddress(int id)
        {
            var addressResult = await _addressRepository.DeleteAddress(id).ConfigureAwait(false);

            if (addressResult == null)
            {
                return(NotFound());
            }

            return(addressResult);
        }
Esempio n. 4
0
        public async Task <ActionResult <int> > Delete([FromRoute] int id)
        {
            var resp = await _addressRepo.DeleteAddress(id);

            if (resp == 0)
            {
                return(NotFound());
            }

            return(Ok());
        }
        public ActionResult Delete(int Id)
        {
            Address deletedAddress = _repository.DeleteAddress(Id);

            if (deletedAddress != null)
            {
                TempData["message"] = $"Usunięto {deletedAddress.Street} - {deletedAddress.Code} - {deletedAddress.Number}";
            }

            return(RedirectToAction("Index"));
        }
        public DeleteAddressResponse DeleteAddress(DeleteAddressRequest deleteAddressRequest)
        {
            var address = _addressRepository.FindAddressById(deleteAddressRequest.Id);

            _addressRepository.DeleteAddress(address);
            var addressDto = _messageMapper.MapToAddressDto(address);

            return(new DeleteAddressResponse
            {
                Address = addressDto
            });
        }
Esempio n. 7
0
        public void DeleteAddress(AddressDTO dto)
        {
            try
            {
                log.Debug(AddressDTO.FormatAddressDTO(dto));

                R_Address t = AddressDTO.ConvertDTOtoEntity(dto);

                // delete
                Repository.DeleteAddress(t);
                dto.IsDeleted = t.IsDeleted;

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Esempio n. 8
0
 public ActionResult DeleteConfirmed(long id)
 {
     try
     {
         _addressRepository.DeleteAddress(id, GetUserId());
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
        public async Task ShouldDeleteOneVendorAddressUsingAddressDomainObj()
        {
            var vendorID = 3;
            var addressParams = new AddressParameters { PageNumber = 1, PageSize = 10 };
            var vendorAddressDomainObjs = await _addressRepo.GetAddresses(vendorID, addressParams);
            var count = vendorAddressDomainObjs.Count;

            Assert.Equal(2, count);

            await _addressRepo.DeleteAddress(vendorAddressDomainObjs[0]);
            vendorAddressDomainObjs = await _addressRepo.GetAddresses(vendorID, addressParams);

            Assert.Equal(count - 1, vendorAddressDomainObjs.Count);
        }
Esempio n. 10
0
        public IActionResult DeleteAddress(int id)
        {
            if (!_addressRepository.AddressExists(id))
            {
                return(NotFound());
            }

            var obj = _addressRepository.GetAddress(id);

            if (!_addressRepository.DeleteAddress(obj))
            {
                ModelState.AddModelError("", $" {obj.Nome}");
                return(StatusCode(500, ModelState));
            }

            return(NoContent());
        }
Esempio n. 11
0
        public async Task <IActionResult> Delete(int customerId, int Id)
        {
            try
            {
                var Address = await _repository.GetAddressAsync(customerId, Id);

                if (Address == null)
                {
                    return(NotFound());
                }

                if (await _repository.DeleteAddress(Address))
                {
                    return(Ok());
                }
            }
            catch (Exception e)
            {
                _logger.LogError(e, e.Message);
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Database Failure"));
            }

            return(BadRequest("Failed to delete the Address"));
        }
Esempio n. 12
0
 public void Delete(int addressIdToDelete)
 {
     _repo.DeleteAddress(addressIdToDelete);
 }
Esempio n. 13
0
 public void DeleteAddress(long addressId)
 {
     _addressRepository.DeleteAddress(addressId);
 }
Esempio n. 14
0
 public void DeleteAddress(string email, int addressId)
 {
     _addressRepository.DeleteAddress(email, addressId);
 }
Esempio n. 15
0
 public IActionResult DeleteAddress(int addressId, int customerId)
 {
     _addressRepository.DeleteAddress(addressId);
     return(RedirectToAction("Addresses", "Customer", new { customerId = customerId }));
 }
        public bool DeleteAddress(Contracts.CryptoBits.AddressOG address)
        {
            var entity = GetEntity(address);

            return(_repo.DeleteAddress(entity).Result);
        }
Esempio n. 17
0
 public IActionResult DeleteUser()
 {
     _address.DeleteAddress(User.Identity.Name);
     _user.DeleteUser(User.Identity.Name);
     return(Ok());
 }
Esempio n. 18
0
 public bool DeleteAddress(System.Int32 AddressId)
 {
     return(_iAddressRepository.DeleteAddress(AddressId));
 }
Esempio n. 19
0
 public bool DeleteAddress(string addressType, string customerId)
 {
     return(repo.DeleteAddress(addressType, customerId));
 }
        public void DeleteAddress(int addressId)
        {
            var address = _addressRepository.GetAddressById(addressId);

            _addressRepository.DeleteAddress(address);
        }