Esempio n. 1
0
        public object Delete(AddressHistoryRequest request)
        {
            var address = _dao.FindById(request.AddressId);

            var account = _accountDao.FindById(new Guid(this.GetSession().UserAuthId));

            if (account.Id != address.AccountId)
            {
                throw new HttpError(HttpStatusCode.Unauthorized, "Can't remove another account's address");
            }

            _commandBus.Send(new RemoveAddressFromHistory {
                AddressId = request.AddressId, AccountId = account.Id
            });

            return(new HttpResult(HttpStatusCode.OK));
        }