public ActionResult EditCommitteeMember(Committee_member model) { if (Request.Files[0].ContentLength == 0 || Request.Files[0].FileName == "") { TempData["MessageType"] = "danger"; TempData["Message"] = "Please input your postal image!!"; return(View(model)); } if (Request.Files[0].ContentLength >= 20000000) { TempData["MessageType"] = "danger"; TempData["Message"] = "File too large!!"; return(View(model)); } if (Request.Files[0].ContentType.Substring(0, 5) != "image") { TempData["MessageType"] = "danger"; TempData["Message"] = "Invalid file type!!"; return(View(model)); } var c = db.Committee_member.Find(model.Id); c.MemberId = model.EligibleMember.Id; c.cmvn = model.cmvn; Committee_member cc = db.Committee_member.Add(c); db.SaveChanges(); TempData["MessageType"] = "success"; TempData["Message"] = "Your Registration was successful!!"; //return RedirectToAction("EditCommitteeMember", new { Id = model.Id }); return(RedirectToAction("CommitteeMembersList")); }
public ActionResult RegisterCommitteeMember(Committee_member model, string email, string password) { #region committee member data validation if (db.EligibleMembers.Where(dbl => dbl.email.ToLower() == email.ToLower() && dbl.password == password).Count() == 0) { TempData["MessageType"] = "danger"; TempData["Message"] = "Invalid email and password combination!!"; return(View(model)); } var memberid = db.EligibleMembers.Where(dbl => dbl.email == model.EligibleMember.email).First().Id; #endregion #region saving committee member data Committee_member c = new Committee_member { MemberId = memberid, cmvn = model.cmvn }; Committee_member cc = db.Committee_member.Add(c); db.SaveChanges(); TempData["MessageType"] = "success"; TempData["Message"] = "Your Registration was successful!!"; return(View()); #endregion }