Exemplo n.º 1
0
        public IHttpActionResult Delete(string id)
        {
            try
            {
                var @event = new MerchantDeleteEvent
                {
                    Id        = Guid.Parse(id),
                    DeletedBy = this.Identity,
                };

                this._merchantService.Delete(@event);

                return(this.Ok());
            }
            catch (FormatException)
            {
                return(this.BadRequest());
            }
            catch (ObjectNotFoundException)
            {
                return(this.NotFound());
            }
            catch (Exception ex)
            {
                return(this.InternalServerError(ex));
            }
        }
Exemplo n.º 2
0
        public void Delete(MerchantDeleteEvent @event)
        {
            var entity = this._merchantEntityService.Get(@event.Id);

            if (entity == null)
            {
                throw new ObjectNotFoundException();
            }

            entity.IsDeleted = true;
            entity.DeletedBy = @event.DeletedBy;
            entity.DeletedOn = DateTime.Now;

            this._merchantEntityService.Edit(entity);
            this._merchantEntityService.Save();
        }