Пример #1
0
        public ActionResult Edit(int id)
        {
            var entity = _wxRepo.Find(id);
            if (entity == null)
                throw new ArgumentException("id not exist");

            var vo = new WXReplyViewModel().FromEntity<WXReplyViewModel>(entity);

            return View(vo);
        }
Пример #2
0
        public ActionResult Edit(FormCollection formCollection, WXReplyViewModel vo)
        {
            if (!ModelState.IsValid)
            {
                return View(vo);
            }
            var entity = _wxRepo.Find(vo.Id);
            entity.MatchKey = vo.MatchKey;
            entity.ReplyMsg = vo.ReplyMsg;
            entity.Status = vo.Status;
            entity.UpdateDate = DateTime.Now;
            _wxRepo.Update(entity);
           

            return RedirectToAction("list");
        }
Пример #3
0
        public ActionResult Create(FormCollection formCollection, WXReplyViewModel vo)
        {
            if (!ModelState.IsValid)
            {
                return View(vo);
            }

                var entity = vo.ToEntity<WXReplyEntity>();
              
                entity.UpdateDate = DateTime.Now;
                _wxRepo.Insert(entity);
              

                return RedirectToAction("Edit", new { id = entity.Id });

        }