Beispiel #1
0
        public ActionResult Register(UserInfo userRegistration, HttpPostedFileBase postedFile, FormCollection coll)
        {
            SathishLayoutEntities1 entities = new SathishLayoutEntities1();

            string indexColl = coll["PlotColl.index"];

            string[] plotIndexColl = indexColl.Split(',');

            string path = Server.MapPath("~/UploadImages/");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            foreach (string index in plotIndexColl)
            {
                PlotDetailsInfo plotInfo = new PlotDetailsInfo();
                plotInfo.UserName           = userRegistration.UserName;
                plotInfo.PlotNumber         = coll["PlotColl[" + index + "]" + ".PlotNumber"];
                plotInfo.Area               = coll["PlotColl[" + index + "]" + ".Area"];
                plotInfo.DocumentNumber     = Convert.ToInt32(coll["PlotColl[" + index + "]" + ".DocumentNumber"]);
                plotInfo.YearOfRegistration = Convert.ToInt32(coll["PlotColl[" + index + "]" + ".YearOfRegistration"]);
                plotInfo.RegistrationOffice = coll["PlotColl[" + index + "]" + ".RegistrationOffice"];
                plotInfo.Nominee            = coll["PlotColl[" + index + "]" + ".Nominee"];
                plotInfo.PlotDocumentPhoto  = coll["PlotColl[" + index + "]" + ".PlotDocumentPhoto"];
                entities.PlotDetailsInfoes.Add(plotInfo);
            }

            //   if (Request.Files.Count > 0)
            //  {

            string fileName = System.IO.Path.GetFileName(postedFile.FileName);
            string filePath = "~/UploadImages/" + fileName;

            postedFile.SaveAs(path + postedFile.FileName);
            userRegistration.Attachments = filePath;
            userRegistration.UserId      = Guid.NewGuid();
            userRegistration.Status      = "In progress";
            userRegistration.PlotNumber  = null;

            entities.UserInfoes.Add(userRegistration);

            entities.SaveChanges();


            // }


            return(RedirectToAction("RegisterSuccess"));
        }
Beispiel #2
0
        //  [HttpPost]
        public ActionResult UpdateStatus(string name, string status)
        {
            SathishLayoutEntities1 dbContext = new SathishLayoutEntities1();
            UserInfo singleUser1             = dbContext.UserInfoes.Where(u => u.UserName == name).FirstOrDefault();


            if (status == "Approved")
            {
                Random generator = new Random();
                int    r         = generator.Next(100000, 999999);

                var memberShipGeneratedId = "MS" + r;
                singleUser1.MemberShipId = memberShipGeneratedId;
            }



            singleUser1.Status = status;
            dbContext.Entry(singleUser1).State = System.Data.Entity.EntityState.Modified;

            dbContext.SaveChanges();
            return(RedirectToAction("GetUsers"));
        }