Ejemplo n.º 1
0
 public void Commit()
 {
     //var list = _pmisEntities.ChangeTracker.Entries().ToList();
     _pmisEntities.SaveChanges();
 }
Ejemplo n.º 2
0
        public ActionResult addProject(project pj, int[] array)
        {
            int         projId = 0;
            participant pp     = new participant();

            try {
                pj.userId      = array[0];
                pj.lastupdated = DateTime.Now.ToString("dddd, dd MMMM yyyy hh:mm tt");
                pj.createddate = DateTime.Now.ToString("dddd, dd MMMM yyyy hh:mm tt");
                pj.status      = "Active";
                db.projects.Add(pj);
                db.SaveChanges();

                projId = pj.projId;
                for (int i = 0; i < array.Length; i++)
                {
                    pp.projId = projId;
                    pp.userId = array[i];
                    pp.status = "Active";
                    db.participants.Add(pp);
                    db.SaveChanges();
                }
                var data = new { status = "Success", projId = pj.projId };
                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(projId, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Register(user p, HttpPostedFileBase file)
        {
            var usercount = db.users.Where(x => x.username == p.username);

            if (usercount.Count() > 0)
            {
                ViewBag.UserExist = true;
                if (p.password != p.password)
                {
                    ViewBag.UserExist   = false;
                    ViewBag.UserAndPass = true;
                }
                return(View("Register"));
            }
            else if (p.password != p.password)
            {
                ViewBag.NotMatch = true;
                return(View("Register"));
            }
            else
            {
                if (file != null)
                {
                    string extension = Path.GetExtension(file.FileName);
                    string location  = "/Uploads/" + p.username.Replace(" ", "") + extension;
                    file.SaveAs(Server.MapPath(location));
                    p.profpath = location;
                    p.status   = "Active";
                    p.password = EncryptMeth(p.password);

                    db.users.Add(p);
                    db.SaveChanges();
                }
                else
                {
                    string location = "/uploads/Default.png";

                    p.profpath = location;
                    p.status   = "Active";
                    p.password = EncryptMeth(p.password);

                    db.users.Add(p);
                    db.SaveChanges();
                }
                return(RedirectToAction("Login"));
            }
        }