public virtual ActionResult GetTextDefault(TextDefaultType type)
        {
            try
            {
                var    data = _textDefaultService.GetByType(Convert.ToInt64(User.LevelId()), type);
                JArray ja   = new JArray();

                foreach (var item in data)
                {
                    var itemObject = new JObject
                    {
                        { "Id", item.Id },
                        { "Text", item.Text },
                        { "TextDefaultType", item.TextDefaultType.GetDescription() },
                        { "TextDefaultTypeId", (int)item.TextDefaultType }
                    };
                    ja.Add(itemObject);
                }
                JObject jo = new JObject();
                jo.Add("total", data.Count());
                jo.Add("rows", ja);
                return(Content(JsonConvert.SerializeObject(jo)));
            }
            catch (Exception)
            {
                return(Json(new { isError = true, Msg = "خطا در لود اطلاعات پست" }));
            }
        }
Esempio n. 2
0
 public virtual PartialViewResult GetPartialTextDefault(string divName, TextDefaultType textDefaultType, string idboxName, string textboxName)
 {
     ViewBag.divName         = divName;
     ViewBag.idboxName       = idboxName;
     ViewBag.textboxName     = textboxName;
     ViewBag.TextDefaultType = textDefaultType;
     return(PartialView(MVC.Home.Views._GetPartialTextDefault));
 }
Esempio n. 3
0
 public virtual ActionResult GetSelectTextDefault(TextDefaultType type)
 {
     try
     {
         long uniId       = Convert.ToInt64(User.LevelId());
         var  textDefault = _textDefaultService.GetByType(uniId, type).ToList();
         var  ja          = textDefault.Select(item => new JObject
         {
             { "value", item.Id },
             { "text", item.Text }
         }).ToList();
         return(Content(JsonConvert.SerializeObject(ja), "application/json"));
     }
     catch (Exception ex)
     {
         return(Json(new { isError = true, Message = "خطا در بارگزاری!" }));
     }
 }
 public virtual ActionResult Index(TextDefaultType type)
 {
     ViewBag.TextDefaultTypeDescription = type.GetDescription();
     ViewBag.TextDefaultType            = type;
     return(View());
 }
 public virtual ActionResult SelectedTextDefault(TextDefaultType type)
 {
     ViewBag.TextDefaultType = type;
     return(PartialView("_SelectedTextDefault"));
 }
 public IQueryable <TextDefault> GetByType(long univercityId, TextDefaultType type)
 {
     return(_textVoteService.Where(x => x.UnivercityId == univercityId && x.TextDefaultType == type));
 }