Exemplo n.º 1
0
        public bool Execute(int cityId, string cityName)
        {
            if (!gateway.LoadCity(cityId, out var c))
            {
                return(false);
            }

            c.Name = cityName;
            gateway.UpdateCity(c);

            return(true);
        }
Exemplo n.º 2
0
        public bool Execute(string firstName, string lastName, DateTime birthDay, int birthCityId, out Employee e)
        {
            if (!gateway.LoadCity(birthCityId, out var birthCity))
            {
                e = null;
                return(false);
            }

            e = new Employee(firstName, lastName, birthDay, birthCity);
            gateway.InsertEmployee(e);

            return(true);
        }
Exemplo n.º 3
0
        public bool Execute(int employeeId, string firstName, string lastName, DateTime birthDay, int birthCityId)
        {
            if (!gateway.LoadEmployee(employeeId, out var e))
            {
                Error = "The employeeId is not existed";
                return(false);
            }

            if (!gateway.LoadCity(birthCityId, out var c))
            {
                Error = "The birthCityId is not existed";
                return(false);
            }

            e.FirstName = firstName;
            e.LastName  = lastName;
            e.BirthDay  = birthDay;
            e.BirthCity = c;

            gateway.UpdateEmployee(e);

            return(true);
        }
Exemplo n.º 4
0
 public bool Execute(int cityId, out City c)
 {
     return(gateway.LoadCity(cityId, out c));
 }