public ActionResult Login(The_Supports spo) { if (spo == null) { return(HttpNotFound()); } else { using (Context db = new Context()) { var support = db.sup.Where(x => x.Supports_Email == spo.Supports_Email && x.Supports_Password == spo.Supports_Password).FirstOrDefault(); if (support == null) { return(HttpNotFound()); } else { if (support.User_Type == "Supports") { Session["ID"] = support.Supports_Id; Session["Name"] = support.Supports_FullName; Session["ImagePath"] = support.Supports_Image_Path; Session["UserType"] = "Supports"; return(RedirectToAction("Home", "The_Supports")); } else { return(RedirectToAction("Login", "Home")); } } } } }
public ActionResult Rigester(The_Supports supports) { if (supports == null) { return(HttpNotFound()); } else { string fileName = Path.GetFileNameWithoutExtension(supports.The_Supports_ImageFile.FileName); string exe = Path.GetExtension(supports.The_Supports_ImageFile.FileName); fileName = fileName + DateTime.Now.ToString("yymmssfff") + exe; supports.Supports_Image_Path = "~/Image/" + fileName; fileName = Path.Combine(Server.MapPath("~/Image/"), fileName); supports.The_Supports_ImageFile.SaveAs(fileName); using (Context db = new Context()) { var voul = db.voulunter.Find(Session["VolID"]); var ministry = db.ministry.Find(Session["ID"]); var visi = db.visitor.Find(voul.Visitro_ID); supports.User_Type = "Supports"; supports.visitor = visi; supports.Supports_Id = visi.Visitro_ID; supports.Num_Of_Child = 0; supports.Accept_Voulnteer = 1; visi.Support_Id = supports.Supports_Id; visi.support = supports; db.Entry(visi).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Home", "Minsitry")); } } }