Exemplo n.º 1
0
        public IHttpActionResult Putreply(int id, reply reply)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != reply.id)
            {
                return(BadRequest());
            }

            db.Entry(reply).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!replyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public List <reply> getReplys(int id)
        {
            try
            {
                String    query     = "SELECT r.[commentid],r.[id],r.[detail],r.[username]FROM[dbo].[reply] r inner join [comment] c on c.id=r.commentid WHERE bookid = " + id + " ";
                DataTable dataTable = dataProvider.excuteQuery(query);

                List <reply> list = new List <reply>();
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    reply a = new reply();
                    a.username = dataTable.Rows[i]["username"].ToString();
                    a.id       = int.Parse(dataTable.Rows[i]["id"].ToString());
                    a.detail   = dataTable.Rows[i]["detail"].ToString();
                    a.cmtid    = int.Parse(dataTable.Rows[i]["commentid"].ToString());
                    list.Add(a);
                }

                return(list);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "Load Account");
            }
            return(null);
        }
Exemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            reply reply = db.replies.Find(id);

            db.replies.Remove(reply);
            db.SaveChanges();
            return(RedirectToAction("Index", "Post"));
        }
Exemplo n.º 4
0
        public ActionResult DoneReply(int id)  //答辩给分
        {
            int     tid = Convert.ToInt32(Request.Cookies["userID"].Value);
            directs d   = db.direct_table.Single(c => c.teacherID == tid && c.stuID == id);
            reply   r   = db.reply_table.Single(c => c.teacherID == tid && c.stuID == id);

            r.score = Convert.ToDouble(Request.Form["myScore"].ToString());
            db.SaveChanges();
            return(RedirectToAction("Reply"));
        }
Exemplo n.º 5
0
        public IHttpActionResult Getreply(int id)
        {
            reply reply = db.replies.Find(id);

            if (reply == null)
            {
                return(NotFound());
            }

            return(Ok(reply));
        }
Exemplo n.º 6
0
        public IHttpActionResult Postreply(reply reply)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.replies.Add(reply);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = reply.id }, reply));
        }
Exemplo n.º 7
0
 //获取该文章评论
 public DataSet GetComments(reply myreply)
 {
     SqlParameter[] parms =
     {
         // data.MakeInParam("@Username",SqlDbType.VarChar,50,myreply.username),
         // data.MakeInParam("@Reply_title",SqlDbType.VarChar,50,myreply.reply_title),
         // data.MakeInParam(reply_content),
         //data.MakeInParam(reply_date),
         data.MakeInParam("@Article_id", SqlDbType.Int, 50, myreply.article_id),
         //data.MakeInParam(username),
     };
     return(data.RunProcReturn("select * from reply where article_id=@Article_id", parms, "reply"));
 }
Exemplo n.º 8
0
        // GET: Replies/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            reply reply = db.replies.Find(id);

            if (reply == null)
            {
                return(HttpNotFound());
            }
            return(View(reply));
        }
Exemplo n.º 9
0
        public IHttpActionResult Deletereply(int id)
        {
            reply reply = db.replies.Find(id);

            if (reply == null)
            {
                return(NotFound());
            }

            db.replies.Remove(reply);
            db.SaveChanges();

            return(Ok(reply));
        }
Exemplo n.º 10
0
        // GET: Replies/Edit/5
        public ActionResult Edit(int?id, int?postid)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            reply reply = db.replies.Find(id);

            if (reply == null)
            {
                return(HttpNotFound());
            }
            ViewBag.posts_postid = new SelectList(db.posts, "postid", "title", reply.posts_postid);
            return(View(reply));
        }
Exemplo n.º 11
0
 public ActionResult Edit([Bind(Include = "repliesid,text,date,posts_postid")] reply reply, int postid)
 {
     if (ModelState.IsValid)
     {
         reply.date            = DateTime.Now;
         reply.posts_postid    = postid;
         reply.username        = User.Identity.Name;
         db.Entry(reply).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToRoute(new
         {
             controller = "Post",
             action = "Details",
             id = postid
         }));
     }
     ViewBag.posts_postid = new SelectList(db.posts, "postid", "title", reply.posts_postid);
     return(View(reply));
 }
Exemplo n.º 12
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (bindingSource1.Current != null)
     {
         reply  reply1  = (reply)bindingSource1.Current;
         string replyId = reply1.replyId.ToString();
         //执行删除
         string url = "https://andyfool.com/file/DelRp/DelRp?rpid=" + replyId;
         HttpApiDel(url, "{}", "POST");
         //获取新的信息
         string urlt = "https://andyfool.com/file/Get2/GetReplies?msid=" + mesId;
         str = HttpApi(urlt, "{}", "POST");
         userservice.replies       = JsonConvert.DeserializeObject <List <reply> >(str);
         bindingSource1.DataSource = userservice.replies;
     }
     else
     {
         MessageBox.Show("No user is selected!");
     }
 }
Exemplo n.º 13
0
        public ActionResult Create([Bind(Include = "repliesid,text")] reply reply, string postID)
        {
            if (ModelState.IsValid)
            {
                reply.date         = DateTime.Now;
                reply.username     = User.Identity.Name;
                reply.posts_postid = Convert.ToInt32(postID);
                db.replies.Add(reply);
                db.SaveChanges();
                return(RedirectToRoute(new
                {
                    controller = "Post",
                    action = "Details",
                    id = Convert.ToInt32(postID)
                }));
            }

            ViewBag.posts_postid = new SelectList(db.posts, "postid", "title", reply.posts_postid);

            return(View(reply));
        }
Exemplo n.º 14
0
        public ActionResult DoReplyTeacherAlloc(int id)   //提交答辩老师分配
        {
            var a       = db.user_table.First(c => c.ID == id);
            var student = (from p in db.user_table
                           where p.academy == a.academy && p.roleID == 0
                           select p).ToArray();

            for (int i = 0; i < student.Length; i++)
            {
                var      str    = student[i].ID.ToString();
                string[] values = Request.Form.GetValues(str);  //????假定每个学生对应的复选框组名称为学号
                for (int j = 0; j < values.Count(); j++)
                {
                    reply r = new reply();
                    r.stuID = student[i].ID;
                    //var u = db.user_table.First(c => c.name == values[i]);  //复选框值为老师姓名
                    //r.teacherID = u.ID;
                    r.teacherID = int.Parse(values[i]);      //复选框值为老师工号
                    db.reply_table.Add(r);
                    db.SaveChanges();
                }
            }
            return(replyTeacherAllocResult(id));    //显示结果
        }
Exemplo n.º 15
0
 var(reply, publicKey) = @event;
Exemplo n.º 16
0
 Send(reply, update.Message.From.Id);