public async Task <IActionResult> PutReinforcementMsgs([FromRoute] int id, [FromBody] ReinforcementMsgs reinforcementMsgs)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != reinforcementMsgs.ReinforcementMsgid)
            {
                return(BadRequest());
            }

            try
            {
                await reinforcementMsgsService.Update(id, reinforcementMsgs);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ReinforcementMsgsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
        public async Task <ReinforcementMsgs> Insert(ReinforcementMsgs tblReinforcementMsgs)
        {
            try
            {
                tblReinforcementMsgs.CreatedDate = DateTime.Now;
                context.Add(tblReinforcementMsgs);
                await context.SaveChangesAsync();

                return(tblReinforcementMsgs);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task <IActionResult> PostReinforcementMsgs([FromBody] ReinforcementMsgs reinforcementMsgs)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var entity = await reinforcementMsgsService.Insert(reinforcementMsgs);

            if (entity == null)
            {
                return(BadRequest());
            }
            return(CreatedAtAction("GetReinforcementMsgsByID", new { id = reinforcementMsgs.ReinforcementMsgid }, reinforcementMsgs));
        }
示例#4
0
 public async Task Update(int Id, ReinforcementMsgs tblReinforcementMsgs)
 {
     try
     {
         if (tblReinforcementMsgs == null)
         {
             throw new ArgumentNullException(nameof(tblReinforcementMsgs));
         }
         if (Id != tblReinforcementMsgs.ReinforcementMsgid)
         {
             throw new NotImplementedException();
         }
         tblReinforcementMsgs.ModifiedDate = DateTime.Now;
         context.TblReinforcementMsgs.Update(tblReinforcementMsgs);
         await context.SaveChangesAsync();
     }
     catch (Exception)
     {
         throw;
     }
 }