コード例 #1
0
 public ActionAnswer HirePerson(int id)
 {
     lock (mLock)
     {
         var wStats = mBuildingRepository.GetStats();
         if (wStats.Persons >= wStats.MaxPersons)
         {
             return(new ActionAnswer(false, "Max employee limit reached."));
         }
         else if (wStats.Persons >= wStats.MaxBathroom)
         {
             return(new ActionAnswer(false, "Max bathroom limit reached."));
         }
         else if (wStats.Persons >= wStats.MaxKitchen)
         {
             return(new ActionAnswer(false, "Max kitchen limit reached."));
         }
         else
         {
             mBuildingRepository.HirePerson(id);
             mActionChanges.Persons.Add(mBuildingRepository.GetPerson(id));
             return(new ActionAnswer(true));
         }
     }
 }
コード例 #2
0
ファイル: PersonController.cs プロジェクト: droppedcode/esims
 public void Post([FromBody] int id)
 {
     BuildingRepository.HirePerson(id);
 }