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));
        }
Beispiel #3
0
        public async Task <IActionResult> PutMThrmsresourceAllocation2([FromRoute] long id, [FromRoute] long recr)
        {
            // if (!ModelState.IsValid)
            // {
            //     return BadRequest(ModelState);
            // }

            // if (id != mThrmsresourceAllocation.MThrmsresourceAllocationId)
            // {
            //     return BadRequest();
            // }

            // _context.Entry(mThrmsresourceAllocation).State = EntityState.Modified;

            // try
            // {
            //     await _context.SaveChangesAsync();
            // }
            // catch (DbUpdateConcurrencyException)
            // {
            //     if (!MThrmsresourceAllocationExists(id))
            //     {
            //         return NotFound();
            //     }
            //     else
            //     {
            //         throw;
            //     }
            // }
            // return CreatedAtAction("GetMThrmsresourceAllocation", mThrmsresourceAllocation.MThrmsresourceAllocationId, mThrmsresourceAllocation);
            AMTDEVContext _context = new AMTDEVContext();
            var           user     = new MThrmsresourceAllocation {
                MThrmsresourceAllocationId = id, RecruiterId = recr
            };

            _context.MThrmsresourceAllocation.Attach(user).Property(x => x.RecruiterId).IsModified = true;
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMThrmsresourceAllocation", user.MThrmsresourceAllocationId, user));
        }
 public MThrmsresourceRequisitionsController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #5
0
 public MThrmsfiletestsController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #6
0
 public MThrmsmanPowerBudgetsController(AMTDEVContext context)
 {
     _context = context;
 }
 public MThrmscvrepositoriesController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #8
0
 public MThrmsonboardingsController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #9
0
 public MThrmsresourceAllocationsController(AMTDEVContext context)
 {
     _context = context;
 }
 public MThrmsofferLettersController(AMTDEVContext context)
 {
     _context = context;
 }
 public MThrmsshortlistsController(AMTDEVContext context)
 {
     _context = context;
 }
 public MThrmsinterviewFeedbacksController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #13
0
 public MThrmsdesignationInventoriesController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #14
0
 public MThrmscandidateEntriesController(AMTDEVContext context)
 {
     _context = context;
 }
 public MThrmsdesignationsController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #16
0
 public MThrmsinterviewChecklistEvaluationsController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #17
0
 public MThrmsattendancesController(AMTDEVContext context)
 {
     _context = context;
 }
 public MThrmscompaniesController(AMTDEVContext context)
 {
     _context = context;
 }
 public MThrmsbranchesController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #20
0
 public MThrmschecklistItemsController(AMTDEVContext context)
 {
     _context = context;
 }
 public MThrmssourcingsController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #22
0
 public MThrmsinterviewScheduleRoundDetailsController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #23
0
 public MThrmsemployeesController(AMTDEVContext context)
 {
     _context = context;
 }
 public MThrmsdepartmentsController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #25
0
 public MThrmsinventoriesController(AMTDEVContext context)
 {
     _context = context;
 }
 public MThrmsinventoryManagementDetailsController(AMTDEVContext context)
 {
     _context = context;
 }
Beispiel #27
0
 public MThrmsinterviewRoundsDefinitionsController(AMTDEVContext context)
 {
     _context = context;
 }