Exemple #1
0
        public void Update(DML.Ships shipObject)
        {
            if (shipObject.ID <= 0)
            {
                throw new ArgumentNullException("Invalid Id");
            }

            IDispatcherShips.Update(shipObject);
        }
Exemple #2
0
        public void Create(DML.Ships shipObject)
        {
            if (shipObject is null)
            {
                throw new ArgumentNullException("Ship cannot be null");
            }

            shipObject.CheckData();

            IDispatcherShips.Create(shipObject);
        }
Exemple #3
0
        public void Update(DML.Ships shipObject)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine($"UPDATE Ships ");
            stringBuilder.AppendLine($"SET Name  =  '{shipObject.Name}', ");
            stringBuilder.AppendLine($" Type   =  {(int)shipObject.Type}, ");
            stringBuilder.AppendLine($" ImagePath   =  '{shipObject.ImagePath}', ");
            stringBuilder.AppendLine($" ThemeId   =  {shipObject.ThemeId} ");
            stringBuilder.AppendLine($"WHERE ID ={shipObject.ID}");

            IUnitOfWork.Executar(stringBuilder.ToString());
        }
Exemple #4
0
        public DML.Ships Get(int shipId)
        {
            var row = IUnitOfWork.Consulta($"SELECT * FROM Ships WITH(NOLOCK) WHERE ID = {shipId}").Tables[0].Rows[0];

            var ship = new DML.Ships
            {
                ID        = Convert.ToInt32(row["ID"]),
                Name      = row["Name"].ToString(),
                Type      = (ShipsTypes)row["Type"],
                ImagePath = row["ImagePath"].ToString(),
                ThemeId   = Convert.ToInt32(row["ThemeId"])
            };

            return(ship);
        }
Exemple #5
0
 public void Create(DML.Ships shipObject)
 {
     IUnitOfWork.Executar(IUnitOfWork.MontaInsertPorAttributo(shipObject).ToString());
 }