Ejemplo n.º 1
0
        public ActionResult SaveAccountRole(RoleViewModel model, int modelId)
        {
            var errors = new List <IModelError>();

            model.Id = 0;  // force a new object regardless
            var result = false;

            if (service.TrySave(model, errors))
            {
                service.AddAccountToRoleForAccountRole(model.Id, modelId);
                result = true;
            }

            return(Json(new
            {
                Model = model,
                Success = result,
                Errors = errors
            }));
        }