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)); } }
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(); }