コード例 #1
0
        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));
        }
コード例 #2
0
        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 }));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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 }));
        }
コード例 #5
0
        // 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;
            }
        }
コード例 #6
0
        public ActionResult Edit(QuotaionVM Quot)
        {
            var editedEmployee = client.PutAsJsonAsync <QuotaionVM>("Quotation/" + Quot.ID, Quot).Result;

            return(RedirectToAction("Index"));
        }