Esempio n. 1
0
        public async Task <IActionResult> PutMstPeriodType([FromRoute] int id, [FromBody] MstPeriodType mstPeriodType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mstPeriodType.PeriodTypeId)
            {
                return(BadRequest());
            }

            _context.Entry(mstPeriodType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MstPeriodTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PostMstPeriodType([FromBody] MstPeriodType mstPeriodType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MstPeriodType.Add(mstPeriodType);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMstPeriodType", new { id = mstPeriodType.PeriodTypeId }, mstPeriodType));
        }