/// <summary> /// List Company /// </summary> /// <returns></returns> public ActionResult ListCompany() { var model = new CompanyDetailsModel(companyServices.GetCompany("All", "")); ViewBag.result = TempData["result"]; return View("~/Areas/Promoter/Views/Company/ListCompany.cshtml",model); }
public ActionResult Company(HttpPostedFileBase file,CompanyDetailsModel model, string submit) { var fileName = ""; if(file!=null) { // change file name with its extension fileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(file.FileName); var uploadUrl = Server.MapPath("~/Content/Upload/Company/MarketingCollatrials/"); file.SaveAs(Path.Combine(uploadUrl, fileName)); } else { fileName = model.MarketingCollatrial; } string action = "Insert"; string password = RandomPassword.GeneratePassword(); if (submit == "Update") { password = logServices.GetPassword(model.Id, "Company");//Get the Compnay Current Passsword action = "Update"; } var result = companyServices.AddorUpdateCompanyDetails(action, model.Id, model.Name, model.Address, model.City, model.State, model.Country, model.Email, model.Phone, model.ContactName, model.ContactEmail, model.ContactPhone, model.About, fileName, model.Username, password); switch(result) { case (int)OutputResult.Successful: ViewBag.result="Successfull"; if (action == "Insert") { // Senting Password Via Eamil //var user = System.Web.HttpContext.Current.Cache["UserDetils"] as UserDetails; //messageServices.SentAutoGeneratePassword(model.Email, password, user.PromoterDetails.Select(m => m.Name).FirstOrDefault()); } break; case (int)OutputResult.UnSucessful: ViewBag.result = "Can't Add New Company"; break; case (int)OutputResult.EmailExists: ViewBag.result = "Email Alredy Exists"; break; case (int)OutputResult.UsernameExists: ViewBag.result = "This username alredy in use"; break; } if (submit == "Update") { return View("~/Areas/Promoter/Views/Company/EditCompany.cshtml", model); } else { return View("~/Areas/Promoter/Views/Company/AddCompany.cshtml", model); } }
/// <summary> /// Edit company /// </summary> /// <param name="id">company id</param> /// <returns></returns> public ActionResult EditCompany(string _com) { var model = new CompanyDetailsModel(companyServices.GetCompany("SelectOnId", _com)); return View("~/Areas/Promoter/Views/Company/EditCompany.cshtml",model); }