// *DN public ActionResult FileUpload(HttpPostedFileBase file) { if (file != null) { using (System.Drawing.Image image = System.Drawing.Image.FromStream(file.InputStream, true, true)) { if (image.Width > 150 && image.Height > 50) { TempData["SuccessMessage"] = "Corporate Logo dimention should be as: Width < 150 px and Height < 50 px."; return(RedirectToAction("RolePermissions")); } } string pic = System.IO.Path.GetFileName(file.FileName); string path = System.IO.Path.Combine( Server.MapPath("~/assets/images/"), pic); // file is uploaded file.SaveAs(path); CorporateBase CorporateBase = new CorporateBase(); CorporateBase.Corporate_logo = pic; CorporateBase.Corporate_action = "logo"; actionResult = adminAction.Corporate_update(CorporateBase); //using (MemoryStream ms = new MemoryStream()) //{ // file.InputStream.CopyTo(ms); // byte[] array = ms.GetBuffer(); //} } // after successfully uploading redirect the user if (actionResult.IsSuccess) { TempData["SuccessMessage"] = "Corporate Logo saved successfully."; } else { TempData["ErrorMessage"] = "Error in saving Corporate Logo."; } return(RedirectToAction("RolePermissions")); }
public DataTable getbackground(string name) { CorporateBase CorporateBase = new CorporateBase(); AdminAction adminAction = new AdminAction(); CorporateBase.Corporate_action = "get"; actionResult = adminAction.Corporate_update(CorporateBase); return(actionResult.dtResult); }