Пример #1
0
        public ActionResult Create(FormCollection formCollection, FeedbackViewModel vo)
        {
            if (ModelState.IsValid)
            {
                var entity = MappingManager.FeedbackEntityMapping(vo);
                entity.CreatedUser = base.CurrentUser.CustomerId;
                entity.UpdatedUser = base.CurrentUser.CustomerId;
                entity.Status = (int)DataStatus.Normal;

                entity = this._feedbackRepository.Insert(entity);

                return Success("/" + RouteData.Values["controller"] + "/edit/" + entity.Id.ToString(CultureInfo.InvariantCulture));
            }

            return View(vo);
        }
Пример #2
0
        public ActionResult Edit(FormCollection formCollection, [FetchFeedback(KeyName = "id")]FeedbackEntity entity, FeedbackViewModel vo)
        {
            if (entity == null || !ModelState.IsValid)
            {
                ModelState.AddModelError("", "参数验证失败.");
                return View(vo);
            }

            var newEntity = MappingManager.FeedbackEntityMapping(vo);
            newEntity.CreatedUser = entity.CreatedUser;
            newEntity.CreatedDate = entity.CreatedDate;
            newEntity.Status = entity.Status;

            MappingManager.FeedbackEntityMapping(newEntity, entity);

            this._feedbackRepository.Update(entity);


            return Success("/" + RouteData.Values["controller"] + "/details/" + entity.Id.ToString(CultureInfo.InvariantCulture));
        }