public async Task <IActionResult> PutMThrmsshortlist([FromRoute] long id, [FromBody] MThrmsshortlist mThrmsshortlist) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mThrmsshortlist.MThrmsshortlistId) { return(BadRequest()); } _context.Entry(mThrmsshortlist).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MThrmsshortlistExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostMThrmsshortlist([FromBody] MThrmsshortlist mThrmsshortlist) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MThrmsshortlist.Add(mThrmsshortlist); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMThrmsshortlist", new { id = mThrmsshortlist.MThrmsshortlistId }, mThrmsshortlist)); }
public async Task <IActionResult> DeleteMThrmssourcing([FromRoute] long id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var mThrmssourcing = await _context.MThrmssourcing.FindAsync(id); if (mThrmssourcing == null) { return(NotFound()); } var _candidate = new MThrmscvrepository() { MThrmscvrepositoryId = (long)mThrmssourcing.CandidateId, Status = "available" }; using (var newContext = new AMTDEVContext()) { newContext.MThrmscvrepository.Attach(_candidate); newContext.Entry(_candidate).Property(X => X.Status).IsModified = true; newContext.SaveChanges(); } var _shortlistrecord = new MThrmsshortlist() { SourcingId = (long)mThrmssourcing.MThrmssourcingId }; // using (var newContext = new AMTDEVContext()) // { // //newContext.MThrmsshortlist.Attach(_shortlistrecord); _context.MThrmsshortlist.Attach(_shortlistrecord); _context.Remove(_shortlistrecord); // newContext.SaveChanges();MIL // } _context.MThrmssourcing.Remove(mThrmssourcing); await _context.SaveChangesAsync(); return(Ok(mThrmssourcing)); }
public async Task <IActionResult> PostMThrmssourcing([FromBody] MThrmssourcing mThrmssourcing) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MThrmssourcing.Add(mThrmssourcing); await _context.SaveChangesAsync(); var _candidate = new MThrmscvrepository() { MThrmscvrepositoryId = (long)mThrmssourcing.CandidateId, Status = "sourcing" }; using (var newContext = new AMTDEVContext()) { newContext.MThrmscvrepository.Attach(_candidate); newContext.Entry(_candidate).Property(X => X.Status).IsModified = true; newContext.SaveChanges(); } var _shortlistrecord = new MThrmsshortlist() { MThrmsshortlistId = 0, ManPowerId = mThrmssourcing.ManPowerId, DesignationId = mThrmssourcing.DesignationId, ResourceRequisitionId = mThrmssourcing.ResourceRequisitionId, JobCode = mThrmssourcing.JobCode, ResourceAllocationId = mThrmssourcing.ResourceAllocationId, RecruiterId = mThrmssourcing.RecruiterId, SourcingId = mThrmssourcing.MThrmssourcingId, CandidateId = mThrmssourcing.CandidateId }; using (var newContext = new AMTDEVContext()) { newContext.MThrmsshortlist.Add(_shortlistrecord); newContext.SaveChanges(); } return(CreatedAtAction("GetMThrmssourcing", new { id = mThrmssourcing.MThrmssourcingId }, mThrmssourcing)); }