public async Task <IHttpActionResult> Post(WAGE wage) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.WAGE.Add(wage); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (WageExists(wage.PERSONID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("PersonalFinanceApi", new { id = wage.PERSONID }, wage)); }
public async Task <IHttpActionResult> Put(decimal personid, WAGE wage) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (personid != wage.PERSONID) { return(BadRequest()); } db.Entry(wage).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (!WageExists(personid)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Get(decimal personid) { WAGE wage = await db.WAGE.FindAsync(personid); if (wage == null) { return(NotFound()); } return(Ok(wage)); }
public async Task <IHttpActionResult> Delete(decimal personid) { WAGE wage = await db.WAGE.FindAsync(personid); if (wage == null) { return(NotFound()); } db.WAGE.Remove(wage); await db.SaveChangesAsync(); return(Ok((WAGE)wage)); }
public ModifyWageWindow(WAGE wage) { InitializeComponent(); DataContext = ViewModel = new ModifyWageViewModel(wage); }