public void Update(DML.Ships shipObject) { if (shipObject.ID <= 0) { throw new ArgumentNullException("Invalid Id"); } IDispatcherShips.Update(shipObject); }
public void Create(DML.Ships shipObject) { if (shipObject is null) { throw new ArgumentNullException("Ship cannot be null"); } shipObject.CheckData(); IDispatcherShips.Create(shipObject); }
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()); }
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); }
public void Create(DML.Ships shipObject) { IUnitOfWork.Executar(IUnitOfWork.MontaInsertPorAttributo(shipObject).ToString()); }