// GET: Attachments/Load public JsonResult Load(int applicantId, IEnumerable <HttpPostedFileBase> file_data) { foreach (var i in file_data.ToList()) { try { db.Attachments.Add(db.AddAttachmentInApplicant(i, applicantId)); db.SaveChanges(); } catch (Exception except) { return(Json("{error: 'You are not allowed to upload such a file. ('" + except.Message + ")}")); } } return(Json("")); }