Esempio n. 1
0
        public async Task <IActionResult> Post([FromBody] ColorMovementStock nColorMovementStock)
        {
            if (nColorMovementStock != null)
            {
                nColorMovementStock.CreateDate = DateTime.Now;
                nColorMovementStock.Creator    = nColorMovementStock.Creator ?? "Someone";
                // null for FK
                nColorMovementStock.ColorItem           = null;
                nColorMovementStock.MovementStockStatus = null;

                return(new JsonResult(await this.repository.AddAsync(nColorMovementStock), this.DefaultJsonSettings));
            }
            return(NotFound(new { Error = "Not found color movement stock data !!!" }));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutByNumber(int key, [FromBody] ColorMovementStock uColorMovementStock)
        {
            var Message = "Color movement stock not been found.";

            if (uColorMovementStock != null)
            {
                // set modified
                uColorMovementStock.ModifyDate = DateTime.Now;
                uColorMovementStock.Modifyer   = uColorMovementStock.Modifyer ?? "Someone";
                // null for FK
                uColorMovementStock.ColorItem           = null;
                uColorMovementStock.MovementStockStatus = null;

                return(new JsonResult(await this.repository.UpdateAsync(uColorMovementStock, key), this.DefaultJsonSettings));
            }
            return(NotFound(new { Error = Message }));
        }