AddPlatform() public static method

public static AddPlatform ( Platform, p ) : void
p Platform,
return void
        public ActionResult Create(FormCollection collection)
        {
            ViewBag.Admins = userManager.GetUsersFromRole("Admin");

            try
            {
                Platform p = new Platform
                {
                    Admins = new List <ApplicationUser> {
                        userManager.GetUser(Convert.ToString(collection["admin"]))
                    },
                    Name = Convert.ToString(collection["name"]),
                };
                platformManager.AddPlatform(p);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View("Error: " + e));
            }
        }
Beispiel #2
0
 public static void AddPlatform(PlatformDto pPlatform, out Result pResult)
 {
     pResult = new Result();
     using (var _db = new Rbr_Db()) {
         _db.BeginTransaction();
         try {
             if (PlatformManager.IsLocationInUse(_db, pPlatform.Location, pPlatform.PlatformId))
             {
                 throw new Exception("Platform with the same name already exists.");
             }
             var _platformRow = MapToPlatformRow(pPlatform);
             PlatformManager.AddPlatform(_db, _platformRow);
             pPlatform.PlatformId = _platformRow.Platform_id;
             _db.CommitTransaction();
         }
         catch (Exception _ex) {
             pPlatform.PlatformId = 0;
             _db.RollbackTransaction();
             pResult.Success      = false;
             pResult.ErrorMessage = _ex.Message;
             TimokLogger.Instance.LogRbr(LogSeverity.Critical, "PlatformController.AddPlatform", string.Format("Exception:\r\n{0}", _ex));
         }
     }
 }
Beispiel #3
0
 void Start()
 {
     PlatformManager.AddPlatform(this);
 }
Beispiel #4
0
 public void ExitDestroy()
 {
     Destroy(transform.parent.gameObject);
     platformManager.AddPlatform();
 }