private void New_Click(object sender, RoutedEventArgs e) { if (RequestNew != null) { RequestNew.Invoke(); } }
public ActionResult Create([Bind(Include = "LecturerId,Name,Email,ContactNo,Module,Qualification,Avatar")] Lecturer lecturer, HttpPostedFileBase Avatar) { var extension = Path.GetExtension(Avatar.FileName); if (ModelState.IsValid && Avatar != null && (extension.Equals(".jpg") || extension.Equals(".jpeg") || extension.Equals(".GIF"))) { string path = Server.MapPath("~/Content/Images2"); //calling the image upload method in ValidateController lecturer.Avatar = Validater.ImageUpload(Avatar, path); lecturer.Qualification = "Lecturer"; lecturer.Module = "Pending"; //calling the RegisterSessionSet to set the sessions RegisterSessionSet(lecturer.Name, lecturer.Email, lecturer.Avatar, 0.0, lecturer.ContactNo, "Lecturer", lecturer.LecturerId); //Save Changes in DB db.Lecturers.Add(lecturer); RequestNew LecReq = new RequestNew { Name = "Auro", Request = lecturer.Name + " Lecturer Been Added To the SEP Tool As a lectureCUT" + lecturer.Avatar + "CUT" + MvcApplication.time, Status = MvcApplication.Pr_two, Loaded = MvcApplication.Pr_two }; db.RequestsNew.Add(LecReq); db.SaveChanges(); return(RedirectToActionPermanent("Pending", "Register")); } else if (!(extension.Equals(".jpg") || extension.Equals(".jpeg") || extension.Equals(".GIF"))) { TempData["error"] = "Please Use A Valid Avatar"; } return(View(lecturer)); }