Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "Id, Language, Module, Key, Value, IsEditable")] Resource resource)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    ResourceServices.Insert(CurrentUser.Id, resource, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            return(View(resource));
        }