public IHttpActionResult postGenerateMember() { try { var memberitem = new List <member>(); var password = password_hash.hash("123456"); var posittion = new string[] { "Frontend Developer", "Backend Developer" }; var role = new Roleaccount[] { Roleaccount.Member, Roleaccount.Employee, Roleaccount.Admin }; var random = new Random(); for (var index = 1; index <= 97; index++) { memberitem.Add(new member { email = $"mail-{index}@mail.com", password = password, firstname = $"firstname {index}", lastname = $"lastname {index}", position = posittion[random.Next(0, 2)], role = role[random.Next(0, 2)], created = DateTime.UtcNow, updated = DateTime.UtcNow }); } var db = new Database1Entities(); db.members.AddRange(memberitem); db.SaveChanges(); return(Json(memberitem)); } catch (Exception ex) { ModelState.AddModelError("Exception", ex); return(BadRequest(ModelState.GerErrorModelState())); } }
public UserLogin(IIdentity identity, Roleaccount roles) : base(identity, new string[] { roles.ToString() }) { }