Example #1
0
        public ActionResult Create(TemplateFormViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    serviceTemplate.Add(new TemplateDto()
                    {
                        TemplateId = model.TemplateId,

                        Name      = model.Name,
                        AdminView = model.AdminView,
                        FrontView = model.FrontView,
                        IsSection = model.IsSection,
                        Active    = model.Active
                    });
                }
                else
                {
                    ModelState.AddModelError("Error", "Algunos datos ingresados no son válidos");
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", "Se ha producido un error: " + ex.Message);
                return(View(model));
            }

            return(RedirectToAction("Index", new { TemplateId = ViewBag.TemplateId, TemplateParentId = ViewBag.TemplateParentId }));
        }
Example #2
0
        public ActionResult ActivityRegister(string RegistrationName, string RegistrationTel, string UserId, string Id)
        {
            //测试用户id
            UserId = "16BB93E1-3C85-47C5-A5C6-735A5C213320";
            ServiceTemplate service = new ServiceTemplate();
            var             count   = service.GetIsRegistration(new Guid(UserId), new Guid(Id));

            if (count > 0)
            {
                return(Json(2));
            }
            else
            {
                return(Json(service.Add(RegistrationName, RegistrationTel, UserId, Id)));
            }
        }