public ActionResult <ReturnMessage> AddSupply(Supply supply) { ReturnMessage returnMessage = new ReturnMessage(); try { supplyService.AddSupply(supply); } catch (Exception ex) { returnMessage.Ret = ex.InnerException.Message; return(returnMessage); } returnMessage.Ret = "add supply successfully"; return(returnMessage); }
public static void CreateSupply() { var radOrder = new Random(DateTime.Now.Millisecond); var supply = new Supply { City = "Sławno", SupplyNumber = String.Format("{0}/{1}/{2}", radOrder.Next(10, 99), radOrder.Next(10, 99), radOrder.Next(1000, 9999)), SupplierId = radOrder.Next(1, 10), CountryCode = "PL", HouseNumber = "10", SupplyStatus = eSupplyStatus.New, PostalCode = "76-100", CreateDate = DateTime.Now.AddDays(radOrder.Next(10)), Street = "Warszkowo", Positions = CreateSupplyPosition(), }; var item = SupplyService.AddSupply(supply); }