public async Task <ActionResult <aa0002> > Postaa0002(aa0002 aa0002) { _context.aa0002.Add(aa0002); await _context.SaveChangesAsync(); return(CreatedAtAction("Getaa0002", new { id = aa0002.aa0002c01 }, aa0002)); }
public async Task <IActionResult> Putaa0002(int id, aa0002 aa0002) { if (id != aa0002.aa0002c01) { return(BadRequest()); } _context.Entry(aa0002).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!aa0002Exists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Update([FromRoute] int id, [FromBody] aa0002 aa0002) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != aa0002.aa002c01) { return(BadRequest()); } _context.Entry(aa0002).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <aa0002> > Postaa0002(aa0002 aa0002) { if (aa0002Exists(aa0002.aa0002c11)) { return(BadRequest("This Work Shift Code Is Exists!")); } _context.aa0002.Add(aa0002); await _context.SaveChangesAsync(); return(CreatedAtAction("Getaa0002", new { id = aa0002.aa0002c01 }, aa0002)); }
public async Task <IActionResult> Postaa0002([FromBody] aa0002 aa0002) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.aa0002.Add(aa0002); await _context.SaveChangesAsync(); return(CreatedAtAction("Getaa0002", new { id = aa0002.aa002c01 }, aa0002)); }
public async Task <IActionResult> Delete(int id) { aa0002 checkRole = _db.aa0002 .Where(a => a.aa0002c01 == id) .Select(a => a).FirstOrDefault(); if (checkRole == null) { return(BadRequest("This role is not exists!")); } _db.aa0002.Remove(checkRole); await _db.SaveChangesAsync(); return(Ok(string.Format("This role id {0} is deleted!", id))); }
public async Task <IActionResult> Update([FromBody] aa0002 role) { aa0002 checkRole = _db.aa0002 .Where(a => a.aa0002c01 == role.aa0002c01) .Select(a => a).FirstOrDefault(); if (checkRole == null) { return(BadRequest("This role is not exists!")); } MD5 algorithm = MD5.Create(); string salt = checkRole.aa0002c20; string roleHash = EncryptData.StringToHash(role.aa0002c21, salt, algorithm); aa0002 outRole = role; outRole.aa0002c20 = salt; outRole.aa0002c21 = roleHash; _db.aa0002.Update(outRole); await _db.SaveChangesAsync(); return(Ok(string.Format("This role {0} is updated!", role.aa0002c21))); }