Exemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            var cRMLead = _crmLeadRepository.Get(id);

            if (cRMLead == null)
            {
                return(HttpNotFound());
            }

            // Check whether i have access to this Lead details
            var hasAccess = cRMLead.AssignedToUserId == WebUser.Id || DoIHaveCRMManageAccess();

            if (!hasAccess)
            {
                return(RedirectToAction("NotAuthorized", "Error", new { area = "" }));
            }

            var mappedTechnologies = _crmLeadTechnologyMapRepository.GetAllBy(m => m.LeadId == cRMLead.Id).Select(m => m.TechnologyId).ToList();

            ViewBag.Technologies     = new MultiSelectList(_technologyRepository.GetAll(), "Id", "Title", mappedTechnologies);
            ViewBag.AssignedToUserId = new SelectList(_userRepository.GetAll("Person"), "Id", "Person.Name", cRMLead.AssignedToUserId);
            ViewBag.LeadSourceId     = new SelectList(_crmLeadSourceRepository.GetAll(), "Id", "Title", cRMLead.LeadSourceId);
            ViewBag.CategoryId       = new SelectList(_crmLeadCategoryRepository.GetAll(), "Id", "Title", cRMLead.CategoryId);
            ViewBag.LeadSourceUserId = new SelectList(_userRepository.GetAll("Person"), "Id", "Person.Name", cRMLead.LeadSourceUserId);
            ViewBag.LeadStatusId     = new SelectList(_crmLeadStatusRepository.GetAll(), "Id", "Name", cRMLead.LeadStatusId);

            var vm = new EditCRMLeadViewModel(cRMLead);

            return(View(vm));
        }
Exemplo n.º 2
0
        public JsonResult Index()
        {
            var apiResult = TryExecute(() => _crmLeadCategoryRepository.GetAll(), "Lead Categories Fetched sucessfully");

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }