public ActionResult CreateGroup(NGroup group) { if (ModelState.IsValid) { using (NMSEntities db = new NMSEntities()) { String FileExt = Path.GetExtension(group.files.FileName).ToUpper(); if (FileExt == ".PDF") { Stream str = group.files.InputStream; BinaryReader Br = new BinaryReader(str); Byte[] FileDet = Br.ReadBytes((Int32)str.Length); NGroup n = new NMS.Models.NGroup(); n.GroupIcon = FileDet; //SaveFileDetails(n); db.NMakeGroups(group.GroupName, n.GroupIcon, group.classID, group.subID); var a = db.NGetGroupIDsss(group.GroupName).FirstOrDefault(); int groupid = a.GroupID; db.NEInsertGroupMemberTeachers(groupid, Session["TID"].ToString(), Session["Name"].ToString()); return(RedirectToAction("FileUpload")); } else { ViewBag.FileStatus = "Invalid file format."; return(View()); } } } return(View()); }