Exemplo n.º 1
0
        public ActionResult Edit([Bind(Include = "RegId,EmailNumber,Password,DonorName,Phone,Age,Address,Qualification,Photo,ImageUrl,GroupId,GenderId")] NewRegistration newRegistration, HttpPostedFileBase FileUpload)
        {
            if (ModelState.IsValid)
            {
                NewRegistration DbRecord = db.NewRegistrations.Where(r => r.RegId == newRegistration.RegId).FirstOrDefault();

                //Save image in folder

                string FileName     = Path.GetFileName(FileUpload.FileName);
                string SaveLocation = Server.MapPath("~/NewRegPicture/" + FileName);
                FileUpload.SaveAs(SaveLocation);

                //save image name in database

                DbRecord.ImageUrl = "~/NewRegPicture/" + FileName;


                // byte image Save


                DbRecord.Photo        = new byte[FileUpload.ContentLength];
                ViewBag.BloodDonorPic = FileUpload.InputStream.Read(DbRecord.Photo, 0, FileUpload.ContentLength);



                db.Entry(newRegistration).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.GroupId  = new SelectList(db.BloodGroups, "GroupId", "GroupName", newRegistration.GroupId);
            ViewBag.GenderId = new SelectList(db.Genders, "GenderId", "GenderName", newRegistration.GenderId);
            return(View(newRegistration));
        }
 public ActionResult Edit([Bind(Include = "UserId,UserName,Password")] Admin admin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(admin).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(admin));
 }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "GroupId,GroupName")] BloodGroup bloodGroup)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bloodGroup).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bloodGroup));
 }
 public ActionResult Edit([Bind(Include = "GenderId,GenderName")] Gender gender)
 {
     if (ModelState.IsValid)
     {
         db.Entry(gender).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(gender));
 }
 public ActionResult Edit(Area area)
 {
     if (ModelState.IsValid)
     {
         db.Entry(area).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AreaId = new SelectList(db.Areas, "Id", "AreaName", area.AreaId);
     return(View(area));
 }
Exemplo n.º 6
0
 public ActionResult Edit(StakeHolder stakeholder)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stakeholder).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AreaId = new SelectList(db.Areas, "Id", "AreaName", stakeholder.AreaId);
     return(View(stakeholder));
 }
Exemplo n.º 7
0
 public ActionResult Edit(BloodRequistion bloodrequistion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bloodrequistion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AreaId        = new SelectList(db.Areas, "Id", "AreaName", bloodrequistion.AreaId);
     ViewBag.StakeholderId = new SelectList(db.StakeHolders, "Id", "FullName", bloodrequistion.StakeholderId);
     return(View(bloodrequistion));
 }
Exemplo n.º 8
0
 public ActionResult Edit(BloodDonationHistory blooddonationhistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(blooddonationhistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StakeholderId = new SelectList(db.StakeHolders, "Id", "FullName", blooddonationhistory.StakeholderId);
     ViewBag.RequisitionId = new SelectList(db.BloodRequistions, "Id", "BloodGroup", blooddonationhistory.RequisitionId);
     return(View(blooddonationhistory));
 }
Exemplo n.º 9
0
 public ActionResult Edit(Notice notice)
 {
     if (ModelState.IsValid)
     {
         db.Entry(notice).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.NoticeToId    = new SelectList(db.StakeHolders, "Id", "FullName", notice.NoticeToId);
     ViewBag.NoticeById    = new SelectList(db.StakeHolders, "Id", "FullName", notice.NoticeById);
     ViewBag.RequisitionId = new SelectList(db.BloodRequistions, "Id", "BloodGroup", notice.RequisitionId);
     return(View(notice));
 }
        public ActionResult Edit([Bind(Include = "Id,Name,Phone,PatientAge,Problem,Address,HospitalName,BloodRequestDate,BloodNeedDate,Countity,Photo,PhotoPathUrl,GroupId,GenderId")] BloodRequest bloodRequest, HttpPostedFileBase FileUpload)
        {
            if (ModelState.IsValid)
            {
                BloodRequest DbRecord = db.BloodRequests.Where(b => b.id == bloodRequest.id).FirstOrDefault();

                //Save image in folder
                try
                {
                    if (FileUpload.FileName != null)
                    {
                        string FileName     = Path.GetFileName(FileUpload.FileName);
                        string SaveLocation = Server.MapPath("~/PictureFolder/" + FileName);
                        FileUpload.SaveAs(SaveLocation);

                        //save image name in database

                        DbRecord.PhotoPathUrl = "~/PictureFolder/" + FileName;


                        // byte image Save


                        DbRecord.Photo        = new byte[FileUpload.ContentLength];
                        ViewBag.BloodDonorPic = FileUpload.InputStream.Read(bloodRequest.Photo, 0, FileUpload.ContentLength);
                    }
                }
                catch (Exception)
                {
                    throw;
                }

                db.Entry(DbRecord).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.GroupId  = new SelectList(db.BloodGroups, "GroupId", "GroupName", bloodRequest.GroupId);
            ViewBag.GenderId = new SelectList(db.Genders, "GenderId", "GenderName", bloodRequest.GenderId);
            return(View(bloodRequest));
        }