Esempio n. 1
0
        public ActionResult Create(FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Create";

            try
            {
                TeamAttributePermission a = new TeamAttributePermission();

                #region Pull from Form Collection
                a.TeamID            = Convert.ToInt32(collection["ddTeam"]);
                a.AttributeID       = Convert.ToInt32(collection["ddAttr"]);
                a.ReadPermission    = Convert.ToInt32(collection["ddRead"]);
                a.WritePermission   = Convert.ToInt32(collection["ddWrite"]);
                a.Notify            = Convert.ToInt32(collection["ddNotify"]);
                a.ViewChange        = Convert.ToInt32(collection["ddView"]);
                a.ParkForQuarantine = Convert.ToInt32(collection["ddPark"]);
                #endregion

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(a, CrudAction, User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content(string.Format("Error on {0} of {1}. Press back to return and try again", CrudAction, a.GetType().Name)));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 2
0
        public ActionResult Delete(string id, FormCollection collection)
        {
            bool   DidItWork  = false;
            string CrudAction = "Delete";

            try
            {
                TeamAttributePermissionBusinessLayer bl = new TeamAttributePermissionBusinessLayer();
                TeamAttributePermission a = bl.TeamAttributePermissions.Where(p => p.ID == id).Single();

                StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer();
                DidItWork = spbl.ExecuteStoredProcedure(a, CrudAction, User.Identity.Name);
                if (DidItWork == false)
                {
                    return(Content(string.Format("Error on {0} of {1}. Press back to return and try again", CrudAction, a.GetType().Name)));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View());
            }
        }