Пример #1
0
        public EntityFile Generate(IEntityType entity)
        {
            var template = new CreateEdit();

            template.Action       = this.Action;
            template.EntityName   = entity.ClrType.Name;
            template.EntityIdName = entity.GetKeys().First().Properties.First().Name;
            template.ColumnNames  = entity.GetProperties()
                                    .OrderByUserExperience(entity)
                                    .Select(p =>
            {
                if (entity.GetForeignKeys().Select(k => k.Properties[0].Name).Contains(p.Name))
                {
                    return(p.Name + CreateEdit.IDENTIFIER_FK);
                }
                else if (p.IsInternalFor(entity))
                {
                    return(p.Name + CreateEdit.IDENTIFIER_HIDDEN);
                }
                else if (p.ClrType == typeof(DateTime))
                {
                    return(p.Name + CreateEdit.IDENTIFIER_DATETIME);
                }
                else
                {
                    return(p.Name);
                }
            })
                                    .ToList();

            return(new EntityFile()
            {
                data = template.TransformText(), path = $"Views/Generated/{entity.ClrType.Name}/{this.Action}.cshtml"
            });
        }
Пример #2
0
        private void btnEditAtricle_Click(object sender, EventArgs e)
        {
            CreateEdit formEdit = new CreateEdit(new User());

            formEdit.ShowDialog();
        }
Пример #3
0
        public async Task<ActionResult> Edit(CreateEdit.Command command)
        {
            await _mediator.SendAsync(command);

            return this.RedirectToActionJson("Index");
        }
Пример #4
0
        private void btnEditUser_Click(object sender, EventArgs e)
        {
            CreateEdit formEdit = new CreateEdit(current);

            formEdit.ShowDialog();
        }
Пример #5
0
        public async Task<ActionResult> Edit(CreateEdit.Query query)
        {
            var model = await _mediator.SendAsync(query);

            return View("CreateEdit", model);
        }