public long Add(TransitEditModel transit, long?forsedCarrierId) { var data = new TransitData(); TransitMapper.Map(transit, data, GetCarrier(forsedCarrierId, transit.CityId, null)); var transitId = _transits.Add(data); return(transitId); }
public static void Map(TransitEditModel @from, TransitData to, long carrierId) { to.Address = @from.Address; to.CarrierId = carrierId; to.WarehouseWorkingTime = @from.WarehouseWorkingTime; to.CityId = @from.CityId; to.DeliveryType = @from.DeliveryType; to.MethodOfTransit = @from.MethodOfTransit; to.Phone = @from.Phone; to.RecipientName = @from.RecipientName; }
public static TransitEditModel Map(TransitData data) { return(new TransitEditModel { Address = data.Address, WarehouseWorkingTime = data.WarehouseWorkingTime, CityId = data.CityId, DeliveryType = data.DeliveryType, MethodOfTransit = data.MethodOfTransit, Phone = data.Phone, RecipientName = data.RecipientName }); }
public long Add(TransitData transit) { if (transit.Id > 0) { throw new InvalidDataException("Id should be undefined"); } return(_executor.Query <long>("[dbo].[Transit_Add]", new { transit.Address, transit.Phone, transit.CarrierId, transit.CityId, transit.DeliveryType, transit.MethodOfTransit, transit.RecipientName, transit.WarehouseWorkingTime })); }
public void Update(TransitData transit) { _executor.Execute("[dbo].[Transit_Update]", transit); }