public async Task <ActionResult> Upload(HttpPostedFileBase upload, int id) { try { var getstudent = await _studentInfoService.Get(id); if (getstudent != null) { if (getstudent.ImageId != 0) { await _imageService.Delete(getstudent.ImageId); } var imgId = await _imageService.Create(upload); await _studentInfoService.UpdateImageId(getstudent.Id, imgId); TempData["success"] = "Update Successful."; return(RedirectToAction("Index")); } } catch (Exception ex) { TempData["error"] = "Update Unsuccessful." + ex; } return(View()); }
public async Task <ActionResult> StudentProfile(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var student = await _studentProfileService.Get(id); var currentpackage = await _studentProfileService.PackageNameForStudent(); ViewBag.currentpackage = currentpackage; if (student == null) { return(HttpNotFound()); } return(View(student)); }
public async Task <ActionResult> StudentProfile(int?id, string studentID) { try { var profile = await _studentService.Get(id); ViewBag.student = profile; var currentpackage = await _studentService.PackageNameForStudent2(studentID); ViewBag.currentpackage = currentpackage; } catch (Exception e) { } return(View()); }