Example #1
0
        public IHttpActionResult UpdateLeadSource(LeadSourceModel model)
        {
            var response = new DataResponse <EntityLeadSource>();

            if (ModelState.IsValid)
            {
                var entityDegree = new EntityLeadSource();
                entityDegree.Id         = model.Id;
                entityDegree.IsActive   = model.IsActive;
                entityDegree.LeadSource = model.LeadSource;
                entityDegree.UpdatedBy  = CurrentUserId;
                entityDegree.UpdatedOn  = System.DateTime.UtcNow;
                response = repository.UpdateLeadSource(entityDegree);
                return(Ok <DataResponse>(response));
            }
            else
            {
                var errorList = ModelState.Where(a => a.Value.Errors.Any()).Select(s => new
                {
                    Key     = s.Key.Split('.').Last(),
                    Message = s.Value.Errors[0].ErrorMessage
                });
                return(Ok <dynamic>(new { Status = HttpStatusCode.BadRequest, Model = errorList }));
            }
        }
Example #2
0
        public ActionResult EditSource(string SourceName, string SourceID)
        {
            objResponse Response = new objResponse();

            session = new SessionHelper();

            LeadSourceModel objSource = new LeadSourceModel();

            try
            {
                Response = objSourceManager.EditSource(SourceName, Convert.ToInt64(SourceID), Convert.ToInt64(session.UserSession.UserId));
                if (Response.ErrorCode == 0)
                {
                    objSource.source = objSourceManager.GetAllSource();;
                    return(View("LeadSourceHome", objSource));
                    //  return Json("Success", JsonRequestBehavior.AllowGet);
                }
                else
                {
                    // objGrpModel.groups = objGroupManager.GetAllGroups();
                    return(Json("", JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                //objGrpModel.groups = objGroupManager.GetAllGroups();
                BAL.Common.LogManager.LogError("EditSource Post Method", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace));
                return(Json("", JsonRequestBehavior.AllowGet));
            }
        }
Example #3
0
        public ActionResult LeadSourceHome()
        {
            LeadSourceModel objModel = new LeadSourceModel();

            objModel.source = objSourceManager.GetAllSource();
            return(View(objModel));
        }
Example #4
0
        public ActionResult DeleteLeadSource(string SourceID)
        {
            string          response  = "";
            LeadSourceModel objSource = new LeadSourceModel();

            try
            {
                response = objSourceManager.DeleteSource(Convert.ToInt64(SourceID));

                if (response == "1")
                {
                    objSource.source = objSourceManager.GetAllSource();;
                    return(View("LeadSourceHome", objSource));
                }
                return(Json(response, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                BAL.Common.LogManager.LogError("DeleteSource Post Method", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace));
                return(Json(response, JsonRequestBehavior.AllowGet));
            }
        }