예제 #1
0
        public ActionResult Comment(MCommentNew mCommentNew)
        {
            mCommentNew.SetOwner(DataBase.Users.GetByAccess(Request.Cookies["access_token"].Value));

            if (ModelState.IsValid)
            {
                if (DataBase.Missions.writecomment(mCommentNew))
                {
                    ModelState.Add("status", new ModelState { Value = new ValueProviderResult("success", "success", null) });

                }
                else
                {
                    ModelState.Add("status", new ModelState { Value = new ValueProviderResult("success", "failed", null) });
                }

            }
               // var missioniew = new MissionView(DataBase.Missions.GetById(mCommentNew.mid));
            return RedirectToAction("GetById", new { id = mCommentNew.mid });// View("Page", missioniew);
        }
예제 #2
0
파일: DataBase.cs 프로젝트: kioltk/mvc
            public static bool writecomment(MCommentNew MCommNew)
            {
                var cont = new dbModelDataContext(ConfigurationManager.ConnectionStrings["quest_projectConnectionString"].ConnectionString);
                var NewMComm = new mcomments()
                {
                    body = MCommNew.body,
                    owner = MCommNew.owner.ID,
                    mid = MCommNew.mid,
                    date = Time.UNIXNow()

                };
                try
                {
                    cont.mcomments.InsertOnSubmit(NewMComm);
                    cont.SubmitChanges();
                    return true;
                    var cont1 = context.mission;
                }
                catch
                {
                    return false;
                }
            }