示例#1
0
        public ActionResult Edit([Bind(Include = "Id,DonorName,bid,gid,DOB,fkstateid,PhoneNo,AadharCardNo,IsActive,CreatedTime,fk_id")] Individual_Donor individual_Donor)
        {
            var userx = User.Identity.GetUserId();

            if (ModelState.IsValid)
            {
                individual_Donor.fk_roleid       = "3";
                individual_Donor.CreatedTime     = DateTime.Now;
                db.Entry(individual_Donor).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.fk_id     = userx;
            ViewBag.bid       = new SelectList(db.Blood_Gp, "Id", "Name", individual_Donor.bid);
            ViewBag.gid       = new SelectList(db.Genders, "Id", "gender1", individual_Donor.gid);
            ViewBag.fkstateid = new SelectList(db.States, "stateid", "StateName", individual_Donor.fkstateid);
            return(View(individual_Donor));
        }
示例#2
0
        // GET: Indv_Donor/Edit/5
        public ActionResult Edit(int?id)
        {
            var userx = User.Identity.GetUserId();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Individual_Donor individual_Donor = db.Individual_Donor.Find(id);

            if (individual_Donor == null)
            {
                return(HttpNotFound());
            }
            ViewBag.fk_id     = userx;
            ViewBag.bid       = new SelectList(db.Blood_Gp, "Id", "Name", individual_Donor.bid);
            ViewBag.gid       = new SelectList(db.Genders, "Id", "gender1", individual_Donor.gid);
            ViewBag.fkstateid = new SelectList(db.States, "stateid", "StateName", individual_Donor.fkstateid);
            return(View(individual_Donor));
        }