public ActionResult Edit(FormCollection collection, Clients client, HttpPostedFileBase agentPhoto) { int id = 0; if (Session["ClientId"] != null) { ViewData["CountryList"] = Utilities.GetCountryList(); ViewData["StateList"] = Utilities.GetStateList(null); id = (int)Session["ClientId"]; } if (!ModelState.IsValid) { return(View(client)); } if (agentPhoto != null) { if (agentPhoto.ContentLength > 0) { Int32 length = agentPhoto.ContentLength; byte[] tempImage = new byte[length]; agentPhoto.InputStream.Read(tempImage, 0, length); client.Logo = tempImage;// file.InputStream; client.ContentType = agentPhoto.ContentType; } } if (AdvocateModels.UpdateClient(id, client) > 0) { return(RedirectToAction("Details", new { @id = id })); } return(View(client)); }
public ActionResult List() { Session["ClientId"] = null; Session["ZoneId"] = null; Session["RegionId"] = null; Session["BranchId"] = null; ViewData.Model = AdvocateModels.GetClients(); return(View()); }
public ActionResult Index(int?id) { if (id != null) { Session["ClientId"] = id; ViewData["ClientName"] = AdvocateModels.GetClientDetailsById((int)id).Name ?? null; } return(View()); }
public ActionResult Edit() { if (Session["ClientId"] != null) { ViewData.Model = AdvocateModels.GetClientById((int)Session["ClientId"]); ViewData["CountryList"] = Utilities.GetCountryList(); ViewData["StateList"] = Utilities.GetStateList(null); } return(View()); }
public ActionResult New(FormCollection collection, Clients client, HttpPostedFileBase agentPhoto) { ViewData["CountryList"] = Utilities.GetCountryList(); ViewData["StateList"] = Utilities.GetStateList(null); try { if (!ModelState.IsValid) { ApplicationMessages msg = new ApplicationMessages("Invalid entry.", MessageType.Error); ViewData["Message"] = msg; return(View()); } // TODO: Add insert logic here if (client != null) { client.LastUpdated = DateTime.Now; client.AdminstratorId = 1; } if (agentPhoto != null) { if (agentPhoto.ContentLength > 0) { Int32 length = agentPhoto.ContentLength; byte[] tempImage = new byte[length]; agentPhoto.InputStream.Read(tempImage, 0, length); client.Logo = tempImage;// file.InputStream; client.ContentType = agentPhoto.ContentType; } } if (AdvocateModels.CreateClient(client) > 0) { ApplicationMessages msg = new ApplicationMessages("New Advocate saved successfully.", MessageType.Success); ViewData["Message"] = msg; return(RedirectToAction("List")); } else { return(View()); } } catch { return(View()); } }
public ActionResult ClientLogoLoader(int id) { Clients oldclient = AdvocateModels.GetClientById(id); if (oldclient != null && oldclient.Logo != null) { var q = oldclient.Logo; byte[] cover = q; // byte[] studentPhoto = StudentModels.GetStudentPhoto(id); if (cover != null) { return(File(cover, "image/jpg")); } } return(null); }
public ActionResult Details(int?id) { if (Session["ClientId"] == null) { if (Roles.IsUserInRole("SuperAdmin")) { Session["ClientId"] = (int)id; ViewData.Model = AdvocateModels.GetClientDetailsById((int)id); return(View()); } } else { if (id != null && (int)Session["ClientId"] == (int)id) { ViewData.Model = AdvocateModels.GetClientDetailsById((int)id); return(View()); } } return(null); }