示例#1
0
        public async Task <IActionResult> CreateSalesReason([FromBody] Sales.SalesReason value)
        {
            _db.Sales_SalesReason.Add(value);
            await _db.SaveChangesAsync();

            return(Ok(value));
        }
示例#2
0
        public async Task <IActionResult> EditSalesReason(int salesReasonID, [FromBody] Sales.SalesReason value)
        {
            var existing = await _db.Sales_SalesReason.FirstOrDefaultAsync(x => x.SalesReasonID == salesReasonID);

            if (existing == null)
            {
                return(NotFound());
            }

            existing.SalesReasonID = value.SalesReasonID;
            existing.Name          = value.Name;
            existing.ReasonType    = value.ReasonType;
            existing.ModifiedDate  = value.ModifiedDate;

            _db.Sales_SalesReason.Update(existing);
            await _db.SaveChangesAsync();

            return(NoContent());
        }