public ActionResult VerifyAccount(string id) { bool Status = false; using (AspContext dc = new AspContext()) { dc.Configuration.ValidateOnSaveEnabled = false; // This line I have added here to avoid // Confirm password does not match issue on save changes var v = dc.AspNetUsers.Where(a => a.Id == id).FirstOrDefault(); if (v != null) { v.IsEnable = "true"; dc.SaveChanges(); Status = true; } else { v.IsEnable = "true"; } dc.SaveChanges(); Status = true; { ViewBag.Message = "Invalid Request"; } } ViewBag.Status = Status; return(View()); }
public ActionResult saveuser(int id, string propertyName, string value) { var status = false; var message = ""; //Update data to database using (AspContext dc = new AspContext()) { var user = dc.UserProfiles.Find(id); if (user != null) { dc.Entry(user).Property(propertyName).CurrentValue = value; dc.SaveChanges(); status = true; } else { message = "Error!"; } } var response = new { value = value, status = status, message = message }; JObject o = JObject.FromObject(response); return(Content(o.ToString())); }
public ActionResult Details(int?id) { AspContext db = new AspContext(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Company company = db.Companies.Find(id); if (company == null) { return(HttpNotFound()); } ViewBag.CompanyId = id.Value; var comments = db.CompanyComments.Where(d => d.CompanyId.Equals(id.Value)).ToList(); ViewBag.Comments = comments; var ratings = db.CompanyComments.Where(d => d.CompanyId.Equals(id.Value)).ToList(); if (ratings.Count() > 0) { var ratingSum = ratings.Sum(d => d.Rating.Value); ViewBag.RatingSum = ratingSum; var ratingCount = ratings.Count(); ViewBag.RatingCount = ratingCount; } else { ViewBag.RatingSum = 0; ViewBag.RatingCount = 0; } return(View(company)); }
public ActionResult CompanyCreate(Company company) { if (ModelState.IsValid) { Company user = null; using (AspContext db = new AspContext()) { user = db.Companies /*.Include(p => p.AspNetUser)*/.FirstOrDefault(u => u.ID == company.ID); } /* if (user == null) * { */ using (AspContext db = new AspContext()) { var id = User.Identity.GetUserId(); db.Companies.Add(new Company { tName = company.tName, Description = company.Description, Tematic = company.Tematic, aspNetUser = id /*aspNetUser=new AspNetUser()*/ }); db.SaveChanges(); user = db.Companies.Where(u => u.tName == company.tName && u.Description == company.Description && u.Tematic == company.Tematic && u.aspNetUser == id).FirstOrDefault(); } if (user != null) { return(RedirectToAction("Index", "Manage")); } } else { ModelState.AddModelError("", "Пользователь с таким логином уже существует"); } return(View(company)); }
public ActionResult InPlace() { ViewBag.ListUser = this.db.UserProfiles.ToList(); //return View(); List <UserProfile> list = new List <UserProfile>(); using (AspContext dc = new AspContext()) { var v = (from a in dc.UserProfiles.AsEnumerable() orderby a.ID select new UserProfile { ID = a.ID, FirstName = a.FirstName, LastName = a.LastName, DOB = a.DOB, }); list = v.ToList(); } return(View(list)); }
public UserBLL(AspContext aspContext) { _aspContext = aspContext; }
public PostBLL(AspContext aspContext) { _aspContext = aspContext; }
public VoteBLL(AspContext aspContext) { _aspContext = aspContext; }
public CommentsBLL(AspContext aspContext) { _aspContext = aspContext; }
public Repository(AspContext context) { this._context = context; this._entities = _context.Set <T>(); }
public UsersController(AspContext context) => _context = context;
public GamesController(AspContext context) => _context = context;
public DevelopersController(AspContext context) => _context = context;
public ActionResult List() { AspContext db = new AspContext(); return(View(db.Companies.ToList())); }
public PlayersController(AspContext context) => _context = context;
public BlogBLL(AspContext aspContext) { _aspContext = aspContext; }