public ActionResult Create() { CategoryService _CategoryService = new CategoryService(_GlobalErrors); SubjectService _SubjectService = new SubjectService(_GlobalErrors); LanguageService _LanguageService = new LanguageService(_GlobalErrors); QuotaionVM obj = new QuotaionVM(); obj.CategoryVMList = _CategoryService.GetAllCategories()?.Select(s => new CategoryVM(s)).ToList(); obj.SubjectVMList = _SubjectService.GetAllSubjects()?.Select(s => new SubjectVM(s)).ToList(); obj.LanguageVMList = _LanguageService.GetAllLanguages()?.Select(s => new LanguageVM(s)).ToList(); return(View(obj)); }
public ActionResult CreateRushRequest(QuotaionVM Quot) { CategoryService _CategoryService = new CategoryService(_GlobalErrors); SubjectService _SubjectService = new SubjectService(_GlobalErrors); LanguageService _LanguageService = new LanguageService(_GlobalErrors); QuotaionVM obj = new QuotaionVM(); //client.PostAsJsonAsync<QuotaionVM>("Quotaion", Quot).ContinueWith((e => e.Result.EnsureSuccessStatusCode())); var x = _QuotationService.GetQuotationForCategory(Quot.MapVM_DM()); obj.CategoryVMList = _CategoryService.GetAllCategories()?.Select(s => new CategoryVM(s)).ToList(); obj.SubjectVMList = _SubjectService.GetAllSubjects()?.Select(s => new SubjectVM(s)).ToList(); obj.LanguageVMList = _LanguageService.GetAllLanguages()?.Select(s => new LanguageVM(s)).ToList(); return(RedirectToAction("Details", new { ID = x.ID })); }
public ActionResult Details(int ID) { CategoryService _CategoryService = new CategoryService(_GlobalErrors); SubjectService _SubjectService = new SubjectService(_GlobalErrors); LanguageService _LanguageService = new LanguageService(_GlobalErrors); QuotaionVM obj = new QuotaionVM(); var QuotationDate = _QuotationService.QuotationStartDate(ID); obj.QuotaionDetailsVMList = _QuotationService.GetQuotationDetails(ID)?.Select(s => new QuotaionDetailsVM(s)).ToList(); foreach (var item in obj.QuotaionDetailsVMList) { item.StartDate = QuotationDate.StartDate; item.EndDate = item.StartDate.AddDays((double)item.NumberOfDays - 1); } obj.CategoryVMList = _CategoryService.GetAllCategories()?.Select(s => new CategoryVM(s)).ToList(); obj.SubjectVMList = _SubjectService.GetAllSubjects()?.Select(s => new SubjectVM(s)).ToList(); obj.LanguageVMList = _LanguageService.GetAllLanguages()?.Select(s => new LanguageVM(s)).ToList(); return(View(obj)); }
public ActionResult Create(QuotaionVM Quot) { CategoryService _CategoryService = new CategoryService(_GlobalErrors); SubjectService _SubjectService = new SubjectService(_GlobalErrors); LanguageService _LanguageService = new LanguageService(_GlobalErrors); QuotaionVM obj = new QuotaionVM(); //client.PostAsJsonAsync<QuotaionVM>("Quotaion", Quot).ContinueWith((e => e.Result.EnsureSuccessStatusCode())); var x = _QuotationService.GetQuotationForCategory(Quot.MapVM_DM()); //obj.QuotaionDetailsVMList = x.QuotaionDetailsList?.Select(s => new QuotaionDetailsVM(s)).ToList(); //foreach (var item in obj.QuotaionDetailsVMList) //{ // item.EndDate = x.StartDate.AddDays((double)item.NumberOfDays - 1); //} obj.CategoryVMList = _CategoryService.GetAllCategories()?.Select(s => new CategoryVM(s)).ToList(); obj.SubjectVMList = _SubjectService.GetAllSubjects()?.Select(s => new SubjectVM(s)).ToList(); obj.LanguageVMList = _LanguageService.GetAllLanguages()?.Select(s => new LanguageVM(s)).ToList(); return(RedirectToAction("Details", new { ID = x.ID })); }
// POST api/quotation public HttpResponseMessage RequestQuotation([FromBody] QuotaionVM dataModel) { try { QuotationDM domainModel = dataModel.MapVM_DM(); domainModel = _QuotaionService.GetQuotationForCategory(domainModel); var msg = Request.CreateResponse(HttpStatusCode.Created, domainModel); return(msg); } catch (Exception ex) { //Errors in this scope indicates system error (not validation errors) //If error exist but not handled, log it and add system error if (!globalErrors.ErrorHandled) { globalErrors.AddSystemError("Service Error: Cannot Request Quotation!"); globalErrors.ErrorHandled = true; return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } throw; } }
public ActionResult Edit(QuotaionVM Quot) { var editedEmployee = client.PutAsJsonAsync <QuotaionVM>("Quotation/" + Quot.ID, Quot).Result; return(RedirectToAction("Index")); }