public ActionResult AllUsers() { var db = new TimecraftDb(); var allUsers = from u in db.Users select u; return View(allUsers); }
public ActionResult Detail(long id, IUser user) { var timecraftDb = new TimecraftDb(); var business = timecraftDb.Business.Include("Administrator").SingleOrDefault(b => b.Id == id); if (business == null) return new HttpNotFoundResult(); return View(business); }
public ActionResult EditUserInfo(UserInfo userInfo, IUser user) { if (!ModelState.IsValid) return View(userInfo); var timecraftDb = new TimecraftDb(); var model = timecraftDb.Users.Single(u => u.Id == user.Id); model.Email = userInfo.Email; model.FirstName = userInfo.FirstName; model.LastName = userInfo.LastName; timecraftDb.SaveChanges(); return Redirect(Url.Action("Index")); }
public ActionResult Create(BusinessInfo businessInfo, IUser user) { if (!ModelState.IsValid) return View(businessInfo); var timecraftDb = new TimecraftDb(); var admin = timecraftDb.Users.Single(u => u.Id == user.Id); var business = new Business { Name = businessInfo.Name, Administrator = admin, }; timecraftDb.Business.Add(business); timecraftDb.SaveChanges(); return Redirect(Url.Action("Detail", new {id = business.Id})); }
public ActionResult Index(IUser signedInUser) { var model = new TimecraftDb().Users.Single(u => u.Id == signedInUser.Id); return View(model); }
public ActionResult EditUserInfo(IUser user) { var model = new TimecraftDb().Users.Single(u => u.Id == user.Id); return View(model); }