示例#1
0
        public async Task <IHttpActionResult> PutEmployerHistory(int id, EmployerHistoryVM EmployerHistoryVM)
        {
            EmployerHistory EmployerHistory = ConvertToDBModel(EmployerHistoryVM);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != EmployerHistory.ID)
            {
                return(BadRequest());
            }

            db.Entry(EmployerHistory).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployerHistoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public async Task <IHttpActionResult> PostUserProfile(EmployerHistoryVM EmployerHistory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EmployerHistories.Add(ConvertToDBModel(EmployerHistory));
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = EmployerHistory.ID }, EmployerHistory));
        }
示例#3
0
 private EmployerHistory ConvertToDBModel(EmployerHistoryVM eh)
 {
     return(new EmployerHistory
     {
         ID = eh.ID,
         LoginID = eh.LoginID,
         EmployerName = eh.EmployerName,
         IsCurrent = eh.IsCurrent,
         FromMonth = eh.FromMonth,
         FromYear = eh.FromYear,
         ToMonth = eh.ToMonth,
         ToYear = eh.ToYear,
         Designation = eh.Designation,
         TeamSize = eh.TeamSize,
         JobProfile = eh.JobProfile,
         NoticePeriod = eh.NoticePeriod,
         DisplayOrder = eh.DisplayOrder,
         UpdatedOn = eh.UpdatedOn
     });
 }