Exemplo n.º 1
0
 public static Scenario UpdateScenario(this IRepositoryAsync<Scenario> repository,
     Scenario scenario, ScenarioResource put)
 {
     if (put.Name != null)
         scenario.Name = put.Name;
     if (put.ActivityLevel != 0)
         scenario.ActivityLevel = put.ActivityLevel;
     if (!String.IsNullOrEmpty(put.Description))
         scenario.Description = put.Description;
     scenario.ObjectState = ObjectState.Modified;
     repository.Update(scenario);
     return scenario;
 }
Exemplo n.º 2
0
 public static Scenario PostScenario(this IRepositoryAsync<Scenario> repository, ScenarioResource post)
 {
     Scenario scenario = new Scenario()
     {
         ScenarioGroupID = post.ScenarioGroupID,
         Name = post.Name,
         Description = post.Description,
         ActivityLevel = post.ActivityLevel,
         TopLevelFragmentID = post.TopLevelFragmentID,
         FlowID = post.ReferenceFlowID,
         DirectionID = Convert.ToInt32(Enum.Parse(typeof(DirectionEnum),post.ReferenceDirection)),
         StaleCache = true
     };
     scenario.ObjectState = ObjectState.Added;
     repository.Insert(scenario);
     return scenario;
 }