Beispiel #1
0
 public ActionResult UpdateScore(Models.RateForm form)
 {
     Model.Weekly weekly = weeklyService.LoadEntities(w => w.Id == form.Id).FirstOrDefault();
     if (weekly == null)
     {
         return(Content(Common.SerializeHelper.SerializeToString(new { state = 1, msg = "该篇周报已被删除!" })));
     }
     weekly.Score    = form.Score;
     weekly.Upvote   = form.Upvote;
     weekly.avgScore = form.avgScore;
     if (weeklyService.EditEntity(weekly))
     {
         return(Content(Common.SerializeHelper.SerializeToString(new { state = 0, msg = "评分成功!" })));
     }
     return(Content(Common.SerializeHelper.SerializeToString(new { state = 1, msg = "评分失败!" })));
 }
Beispiel #2
0
        public ActionResult WriteWeekly()
        {
            DateTime weekStartDate = WeekHelper.GetMondayDate();
            DateTime weekEndDate   = WeekHelper.GetSundayDate();

            string userInfoSID = Request.Cookies["userInfoSID"].Value;

            Model.UserInfo userInfo = Common.SerializeHelper.DeserializeToObject <Model.UserInfo>(MemcacheHelper.Get(userInfoSID).ToString());

            Model.Weekly weekly = weeklyService.LoadEntities(w => w.SubTime >= weekStartDate &&
                                                             w.SubTime <= weekEndDate &&
                                                             w.UserId == userInfo.ID).FirstOrDefault();


            if (weekly == null)
            {
                return(View());
            }
            //return View();
            return(RedirectToAction("Index", "Weekly"));
        }