public ActionResult Register(UsersLoginViewModel Users) { foreach (var us in Userservice.Get()) { if (us.Name == Users.Name) { ViewBag.RegisterUsers = "User name exists already"; return(View(Users)); } } Userservice.Save(Users as UsersViewModel); return(RedirectToAction("Login")); }
public ActionResult Projectsave(ProjectsViewModel model) { if (ModelState.IsValid == false) { var Users = Userservice.Get(); ViewBag.Status = ProjectStatusesService.Get(); ViewBag.Users = new SelectList(Users, "Id", "Name"); return(View(model)); } Projectservice.Save(model); RolesService.New(Projectservice.GetLast(), "group mannager"); Userservice.Save(new RefUserProViewModel { UserId = ((UsersViewModel)Session["CurrentUsers"]).Id, IsOwner = true, ProjectId = Projectservice.GetLast(), ProjecrId = Projectservice.GetLast(), Task = new Services.Entities.TasksRoles { RoleId = RolesService.GetLast() } }); return(View("CloseAndRefresh")); }