Exemple #1
0
        public virtual async Task <ActionResult> Edit([ModelBinder(typeof(EntityModelBinder))] TDto model)
        {
            var viewModel = await EntityServicer.CreateEditModelAsync(model);

            if (ModelState.IsValid)
            {
                await EntityServicer.UpdateEntity(model.MapTo());

                return(PartialView("_Form", viewModel));
            }
            else
            {
                Response.StatusCode             = 500;
                Response.TrySkipIisCustomErrors = true;
                return(PartialView("_Form", viewModel));
            }
        }
Exemple #2
0
        /// <summary>
        ///     Edit 操作。
        /// </summary>
        /// <param name="id">实体主键。</param>
        /// <returns></returns>
        public virtual async Task <ActionResult> Edit(string id)
        {
            var editModel = await EntityServicer.CreateEditModelAsync(id);

            return(View(editModel));
        }