public bool CreateHistory(string Id, string Action, DateTime Nextdate, string NextAction) { try { JobHistoryModel History = new JobHistoryModel(); History.JobId = Id; History.UserId = "Rubel"; History.ActionDate = DateTime.Now; History.ActionDetails = Action; History.NextActionDate = Nextdate; History.NextAction = NextAction; _data.JobHistory.Add(History); int id = Int32.Parse(Id); var job = _data.jobs.FirstOrDefault(x => x.Id == id); job.NextAction = NextAction; _data.SaveChanges(); return(true); } catch { return(false); } }
public HttpResponseMessage Save(JobHistoryModel aJobHistoryModel) { try { if (this.ModelState.IsValid) { var jobHistoryList = service.SaveJobHistory(aJobHistoryModel); if (jobHistoryList != null) { return(Request.CreateResponse(HttpStatusCode.OK, jobHistoryList)); } else { string message = "Error Saving Data"; return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message)); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.InnerException.Message)); } }
public HttpResponseMessage DeleteJobHistorys(JobHistoryModel aJobHistoryModel) { try { if (this.ModelState.IsValid) { var result = service.DeleteJobHistory(aJobHistoryModel); if (result != null) { return(Request.CreateResponse(HttpStatusCode.OK, result)); } else { string message = "Not deleted successfully"; return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message)); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
protected override async Task OnInitializedAsync() { if (Id != 0) { JobHistory = await JobHistoryService.Get(Id.ToString()); } }
public bool SaveJobInfo(JobModel model) { try { model.Status = "Not Reply Yet"; model.UserId = "Rubel"; model.ApplyDate = DateTime.Now; model.NextAction = "Follow up on the application"; _data.jobs.Add(model); _data.SaveChanges(); JobHistoryModel history = new JobHistoryModel(); history.UserId = "Rubel"; history.JobId = model.Id.ToString(); history.ActionDate = DateTime.Now; history.NextAction = "Follow up on the application"; history.NextActionDate = model.Date; history.ActionDetails = "Follow up on the application"; _data.JobHistory.Add(history); CalanderModel MyCalander = new CalanderModel(); MyCalander.UserId = "Rubel"; MyCalander.Titel = "Follow up on the application"; MyCalander.Description = "Position: " + model.Position + ". " + "Company :" + model.Company + ". " + "Address :" + model.Address + ". " + "Contac :" + model.ContacInfo + ". " + "Deadline :" + model.Date; MyCalander.Event = "Job Application"; MyCalander.Date = model.Date; MyCalander.Status = true; _data.Calander.Add(MyCalander); _data.SaveChanges(); return(true); } catch { return(false); } }