示例#1
0
        public ActionResult PlayGroundOwnerRegistration(TblPlayGroundOwner model, string city, string Category, HttpPostedFileBase postedFile)
        {
            var userid = Session["UserId"].ToString();

            List <TblCountry> countries = db.Country_tbl.ToList();

            ViewBag.CountryList = new SelectList(countries, "CountryId", "Country");

            List <TblUser> user = db.User_tbl.ToList();

            ViewBag.UserList = new SelectList(user, "UserId", "UserId");

            if (ModelState.IsValid)
            {
                db.PlayGroundOwner_tbl.Add(new TblPlayGroundOwner
                {
                    PGOwnerReferenceNumber = "1",
                    //PlayerId = model.PlayerId,
                    Name             = model.Name,
                    Mobile           = model.Mobile,
                    Category         = model.Category,
                    CityId           = Convert.ToInt32(city),
                    Confirmed        = 1,
                    RegistrationDate = DateTime.Now,
                    ExpirationDate   = DateTime.Now,
                    UserId           = Convert.ToInt32(userid),
                    Status           = 1,
                    CreatedId        = 1,
                    CreatedDate      = DateTime.Now,
                    ModifiedId       = 0,
                    ModifiedDate     = DateTime.Now
                });


                db.SaveChanges();



                return(RedirectToAction("PlayGroundOwner"));
            }
            return(View());
        }
示例#2
0
        public ActionResult EditProfile(int id, TblPlayGroundOwner model, string city)
        {
            List <TblCountry> countries = db.Country_tbl.ToList();

            ViewBag.CountryList = new SelectList(countries, "CountryId", "Country");

            var EditPlayGroundOwnerList = db.PlayGroundOwner_tbl.Where(x => x.PGOwnerId == id && x.Status == 1).FirstOrDefault();

            if (EditPlayGroundOwnerList != null)
            {
                EditPlayGroundOwnerList.Name     = model.Name;
                EditPlayGroundOwnerList.Mobile   = model.Mobile;
                EditPlayGroundOwnerList.Category = model.Category;
                db.SaveChanges();
            }
            //db.Entry(model).State = System.Data.Entity.EntityState.Modified;
            //db.SaveChanges();

            return(Content("<script>alert('Updated Successfully');location.href='PlayGroundOwnerView';</script>"));
        }