Ejemplo n.º 1
0
        // GET: MainWorkPlace/Delete/5
        public ActionResult Delete(Nullable <int> id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Db            db            = new Db(DbServices.ConnectionString);
            MainWorkPlace mainWorkPlace = MainWorkPlaceServices.Get(id.Value, db);

            if (mainWorkPlace == null)
            {
                return(HttpNotFound());
            }
            return(View(mainWorkPlace));
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind(Include = "Id, Name")] MainWorkPlace mainWorkPlace)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    MainWorkPlaceServices.Insert(CurrentUser.Id, mainWorkPlace, 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(mainWorkPlace));
        }