public PoolController(CustomizationOption customizationOptions, MinerContext dbContext, PlotService plotService, PlotterService plotterService) { CustomizationOptions = customizationOptions; DbContext = dbContext; PlotService = plotService; PlotterService = plotterService; }
public MinerController(MinerContext dbContext, FirewallService firewallService, PlotService plotService, PlotterService plotterService) { DbContext = dbContext; FirewallService = firewallService; PlotService = plotService; PlotterService = plotterService; }
public BasicAuthHandler(IOptionsMonitor <BasicAuthOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, MinerContext dbContext, HashingService hashingService) : base(options, logger, encoder, clock) { DbContext = dbContext; HashingService = hashingService; }
public UserController(MinerContext dbContext, HashingService hashingService, CustomizationOption customizationOptions, UserService userService) { DbContext = dbContext; HashingService = hashingService; CustomizationOptions = customizationOptions; UserService = userService; }
public HttpResponseMessage getEmployeeOfId(int id) { if (id <= 0) { //invalid id for employee to be searched return Request.CreateErrorResponse(HttpStatusCode.BadRequest, new ArgumentException(String.Format( "Cannot find employee of the id: {0}", id))); } using (MinerContext db = new MinerContext()) { var emp = db.Employees.Where(x => x.Id == id).FirstOrDefault(); if (emp == null) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, new ArgumentException(String.Format( "Cannot find employee of the id: {0}", id))); } Reportee rep = Mapping.ToWeb<Employee, Reportee>(emp); if (rep ==null) { return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, new InvalidCastException("something went wrong on the server")); } return Request.CreateResponse(HttpStatusCode.OK, rep); } }
public HttpResponseMessage getReporteesOfMgr(int id) { List<Reportee> result = new List<Reportee>(); using (MinerContext db = new MinerContext()) { var manager = db.Managers.Where(x => x.Id == id).FirstOrDefault(); if (manager ==null) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, new ArgumentException(String.Format( "manager of the id : {0} not found ", id))); } Array.ForEach(manager.Reportees.ToArray(), r => { Reportee rep = Mapping.ToWeb<Employee, Reportee>(r); if (rep!=null) { rep.skillcount = db.SkillMaps.Where(x=>x.Employee.Id==rep.id).Count(); rep.updatedskills = db.SkillMaps.Where(x => x.Employee.Id == rep.id && x.Level.Level!=0).Count(); } result.Add(rep); }); } return Request.CreateResponse(HttpStatusCode.OK,result); }
/// <summary> /// does thelogin operation /// </summary> /// <param name="user">contains only email and password for the user, rest needs to be hydrated form the server</param> /// <returns>resposem message</returns> public HttpResponseMessage getLoginUser(LoginUser user) { LoginUser result = default(LoginUser); if (String.IsNullOrWhiteSpace(user.email) || String.IsNullOrWhiteSpace(user.password)) { //this is not a valid login should be sent back as a bad request return Request.CreateErrorResponse(HttpStatusCode.BadRequest, new ArgumentException("Email or password cannot be null..")); } using (MinerContext db = new MinerContext()) { //getting the contextual employee var employee = db.Employees.Where(x => x.Email == user.email).FirstOrDefault(); if (employee==null) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, new ArgumentException("Not an ENGSP employee? contact admin and get registered")); } //testing to see if the employee is a manager Manager manager = db.Managers.Where(x => x.Id == employee.Id).FirstOrDefault(); if (manager ==null) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, new ArgumentException("Not an ENGSP manager ? contact admin for resolution")); } var isvalidPasswd = manager.Id.ToString() == user.password; if (!isvalidPasswd) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, new ArgumentException("Incorrect password..")); } //validation of the passwd //serialization of the obejct from the database result = Mapping.ToWeb<Employee, LoginUser>(employee); if (result ==null) { return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Something inside the server went wrong!"); } //fitting up the extra information for the webapp result.authentic = true; result.role = "manager"; result.password = result.id.ToString(); } //sending thsi back to the webapp return Request.CreateResponse(HttpStatusCode.OK, result); }
public WalletController(MinerContext dbContext, WalletService walletService, HashingService hashService) { DbContext = dbContext; WalletService = walletService; HashService = hashService; }
public MinerController(MinerContext dbContext, MinerService minerService, CustomizationOption customizationOptions) { DbContext = dbContext; MinerService = minerService; CustomizationOptions = customizationOptions; }
public PoolController(CustomizationOption customizationOptions, MinerContext dbContext) { CustomizationOptions = customizationOptions; DbContext = dbContext; }
public PlotterAuthenticationHandler(IOptionsMonitor <PlotterAuthenticationOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, MinerContext dbContext) : base(options, logger, encoder, clock) { DbContext = dbContext; }
public PlotterController(MinerContext dbContext, PlotterService plotterService) { DbContext = dbContext; PlotterService = plotterService; }
public PlotterController(MinerContext dbContext, PlotterService plotterService, CustomizationOption customizationOptions) { DbContext = dbContext; PlotterService = plotterService; CustomizationOptions = customizationOptions; }
public PlotController(PlotterService plotterService, MinerContext dbContext) { PlotterService = plotterService; DbContext = dbContext; }
public UserController(MinerContext dbContext) { DbContext = dbContext; }
public MinerController(MinerContext dbContext, MinerService minerService) { DbContext = dbContext; MinerService = minerService; }
public WalletController(MinerContext dbContext, WalletService walletService) { DbContext = dbContext; WalletService = walletService; }
public CertificateController(MinerContext dbContext) { DbContext = dbContext; }