public void Activate(IStronghold stronghold) { stronghold.BeginUpdate(); stronghold.StrongholdState = StrongholdState.Neutral; regionManager.Add(stronghold); stronghold.EndUpdate(); chat.SendSystemChat("STRONGHOLD_ACTIVE", stronghold.Name); }
private void Add(IBarbarianTribe barbarianTribe) { barbarianTribes.AddOrUpdate(barbarianTribe.ObjectId, barbarianTribe, (id, old) => barbarianTribe); barbarianTribe.BeginUpdate(); regionManager.Add(barbarianTribe); barbarianTribe.EndUpdate(); barbarianTribe.CampRemainsChanged += BarbarianTribeOnCampRemainsChanged; }
public ActionResult AddNewRegion(Region model) { // ViewBag.DivisionId = new SelectList(_iDivisionGateway.GetAll(), "DivisionId", "DivisionName"); try { if (ModelState.IsValid) { bool rowAffected = _iRegionManager.Add(model); if (rowAffected) { ModelState.Clear(); return(RedirectToAction("All")); } } return(View()); } catch (Exception exception) { string message = exception.Message; return(View()); } }
public IActionResult Add(IFormFile Data, string Description, string HotelName, string TownName, string RegionName, int Price) { Tour Tour = new Tour(); Tour.Description = Description; int idregion; try { idregion = _managerregion.FindRegion(RegionName); } catch { _managerregion.Add(RegionName); idregion = _managerregion.FindRegion(RegionName); } int idtown; try { idtown = _managertowns.FindTowns(TownName, idregion); } catch { _managertowns.Add(TownName, idregion); idtown = _managertowns.FindTowns(TownName, idregion); } int idHotel; try { idHotel = _managerhotel.FindHotel(HotelName, idtown); } catch { _managerhotel.Add(HotelName, idtown); idHotel = _managerhotel.FindHotel(HotelName, idtown); } Tour.HotelId = idHotel; Tour.Price = Price; _managertour.Add(Tour); //----------------------------------------------------------------------------- if (Data != null) { byte[] imageData = null; // считываем переданный файл в массив байтов using (var binaryReader = new BinaryReader(Data.OpenReadStream())) { imageData = binaryReader.ReadBytes((int)Data.Length); } // установка массива байтов _managertour.AddImage(imageData, 5); } return(Redirect("/ManageTours")); }