public async Task <IRequestType> Update(IRequestType entity) { TRequestType tEntity = entity as TRequestType; var errors = await this.ValidateEntityToCheckExistsAtUpdate(tEntity); if (errors.Count() > 0) { await this.ThrowEntityException(errors); } try { this.StartTransaction(); await base.Update(tEntity, x => new { x.Name, x.Description, x.Enabled, x.ModifiedBy, x.ModifiedDate }); this.CommitTransaction(); return(tEntity); } catch (PostgresException ex) { throw new EntityUpdateException(ex); } catch { throw; } }
public async Task <IRequestType> AddNew(IRequestType entity) { TRequestType tEntity = entity as TRequestType; var errors = await this.ValidateEntityToCheckExists(tEntity); if (errors.Count() > 0) { await this.ThrowEntityException(errors); } try { this.StartTransaction(); var savedEntity = await base.AddNew(entity as TRequestType); this.CommitTransaction(); return(savedEntity); } catch (PostgresException ex) { throw new EntityUpdateException(ex); } catch { throw; } }
internal static IRequestType GetArgonautRequestType(this HttpContext context, string apiPath, bool includeAuthGeneration) { if (context.Request.Path.ToString().ToLower().Contains(apiPath.ToLower())) { return(new BearerRequestType()); } if (!context.Request.HasFormContentType) { return(new UnknownRequestType()); } if (!includeAuthGeneration) { return(new UnknownRequestType()); } IRequestType requestType = null; if (context.Request.Form.Keys.Contains("grant_type")) { var pascalGrantType = (from x in context.Request.Form["grant_type"].ToString().Split('_') let first_char = char.ToUpper(x[0]) let rest_chars = new string(x.Skip(1).Select(c => char.ToLower(c)).ToArray()) select first_char + rest_chars).Aggregate((x, y) => x + "" + y); requestType = (from at in ArgonautRequestTypes.GetTypes() let t = at.GetType() where t.Name.Substring(0, t.Name.Replace("RequestType", "").Length).Equals(pascalGrantType) select at).FirstOrDefault(); } if (requestType != null) { return(requestType); } else { return(new UnknownRequestType()); } }
public void Send(IRequestType message) => SendInternal(message);
public RequestController(IRequest request, IRequestType requestType, ICustomer customer) { _request = request; _customer = customer; }