Esempio n. 1
0
        public override HttpHandlerResult Get()
        {
            var vm = new AgentEditVM {
                AgentId = GetQuery("id"),
            };

            vm.PageTitle = $"Photon Server {(vm.IsNew?"New":"Edit")} Agent";

            vm.Build();

            return(Response.View("Agent\\Edit.html", vm));
        }
Esempio n. 2
0
        public override HttpHandlerResult Post()
        {
            var vm = new AgentEditVM(this);

            try {
                vm.Restore(Request.FormData());
                vm.Save();

                return(Response.Redirect("Agents"));
            }
            catch (Exception error) {
                vm.Errors.Add(error);

                vm.Build();

                return(Response.View("Agent\\Edit.html", vm));
            }
        }