public override IHttpActionResult Delete(DeleteActionType type, string id) { var payment = _service.GetByIdAsNoTracking(id); var httpActionResult = base.Delete(type, id); _subscriptionService.UpdatePaymentStatus(payment.SubscriptionId, SubscriptionPaymentStatus.Unpaid); return(httpActionResult); }
public virtual async Task <bool> DeleteAsync(TEntity entity, DeleteActionType actionType) { _deleteActionType = actionType; string ruleset = EnumHelper.GetDescription(actionType); if (string.IsNullOrEmpty(ruleset)) { throw new DSWException(string.Concat("ServiceDelete: Invalid ActionType ", actionType), null, DSWExceptionCode.VA_RulesetValidation); } return(await DeleteAsync(entity, ruleset)); }
public override IHttpActionResult Delete(DeleteActionType type, string id) { if (!User.IsInRole(StaticRoles.SystemAdmin.Name)) { return(BadRequest("Your are not authorized to delete tenant")); } IHttpActionResult actionResult; using (TransactionScope scope = new TransactionScope()) { var run = Task.Run(async() => await _tenantManager.DeleteTenantDependencyAsync(id)); run.Wait(); actionResult = base.Delete(type, id); scope.Complete(); } return(actionResult); }
public virtual IHttpActionResult Delete(DeleteActionType type, string id) { if (string.IsNullOrWhiteSpace(id)) { return(BadRequest("Id can not be null or empty or white space")); } switch (type) { case DeleteActionType.Delete: var delete = Service.Delete(id); return(Ok(delete)); case DeleteActionType.Trash: var trash = Service.Trash(id); return(Ok(trash)); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public async Task <IHttpActionResult> DeleteAsync([FromBody] TEntity entity, DeleteActionType actionType) { _deleteActionType = actionType; return(await DeleteAsync(entity, async (e) => await _service.DeleteAsync(e, actionType))); }