Exemple #1
0
        public ActionResult Index(HttpPostedFileBase postedFile, BigViewModel bigModel)
        {
            //string strDDLValue = Request.Form["Country"].ToString();

            string Separator        = bigModel.ReportHeader.ElementSeparator; //report.ElementSeparator;
            string NewLineSeperator = bigModel.ReportHeader.NewlineSeparator; //report.NewlineSeparator;

            //storing in session
            Session["ElementSeparator"] = Separator;
            Session["NewlineSeparator"] = NewLineSeperator;


            //Separator input cleaning
            if (NewLineSeperator == "\\r\\n")
            {
                NewLineSeperator = "\r\n";
            }

            if (NewLineSeperator == "\\n")
            {
                NewLineSeperator = "\n";
            }

            if (postedFile != null)
            {
                string result = string.Empty;

                using (BinaryReader b = new BinaryReader(postedFile.InputStream))
                {
                    byte[] binData = b.ReadBytes(postedFile.ContentLength);
                    result = System.Text.Encoding.UTF8.GetString(binData);
                }

                string[] resultArray = result.Split(new string[] { NewLineSeperator }, StringSplitOptions.None).Take(50).ToArray();



                string[][] LabelMatrix = CreateMatrix(resultArray, Separator);

                //LabelMatrix = CreateMatrix(resultArray, Separator); //unwanted duplicate

                Session["LabelMatrix"] = LabelMatrix;

                ViewBag.LabelMatrix = LabelMatrix;

                ViewBag.Separator = Separator;

                //ViewBag.Preview = result.Remove(1000);    //Use this variable to display a plain preview

                //ProcessTxtPRICAT(result, report);
            }
            else
            {
                ViewBag.NoFileMessage = "Please upload file.";
            }

            return(View());

            //return RedirectToAction("Index");
        }
Exemple #2
0
        public async Task <IActionResult> NewComment(int id, BigViewModel bigViewModel)
        {
            if (bigViewModel.CommentViewModel.Content == null || bigViewModel.CommentViewModel.Content.Length <= 0)
            {
                ModelState.AddModelError("", "Text field is required!");

                return(RedirectToAction("DetailsBlogPost", "Blog", new
                {
                    id,
                    bigViewModel
                }));
            }

            BlogPostDataModel blogPostDataModel = this.applicationDbContext.BlogPosts.FirstOrDefault(c => c.Id == id);

            blogPostDataModel.Comments += 1;
            this.applicationDbContext.BlogPosts.Update(blogPostDataModel);

            this.applicationDbContext.Comments.Add(new CommentDataModel
            {
                BlogPostId  = id,
                Content     = bigViewModel.CommentViewModel.Content,
                UploadDate  = DateTime.Now,
                CreatorId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier),
                CreatorName = HttpContext.User.Identity.Name
            });

            await this.applicationDbContext.SaveChangesAsync();

            return(RedirectToAction("DetailsBlogPost", "Blog", new {
                blogPostDataModel.Id,
                bigViewModel
            }));
        }
        public IActionResult NextQuestion(Guid AnswerId)
        {
            var answerItem   = _infecenceMachine.GetAnswer(AnswerId);
            var questionItem = _infecenceMachine.GetQuestion(answerItem.NextQuestionId);

            if (questionItem == null)
            {
                var finalAnswer = _infecenceMachine.GetAnswer(answerItem.NextQuestionId);
                var model       = new AnswerViewModel {
                    AnswerId = finalAnswer.AnswerId, AnswerText = finalAnswer.AnswerText
                };
                return(RedirectToAction("FinalAnswer", model));
            }

            var questionItems = _infecenceMachine.GetAnswersForQuestion(questionItem.QuestionId);

            var viewModel = new BigViewModel
            {
                QuestionViewModel = new QuestionViewModel
                {
                    QuestionId      = questionItem.QuestionId,
                    QuestionText    = questionItem.QuestionText,
                    QuestionAnswers = mapAnswer(questionItems)
                }
            };

            return(View(viewModel));
        }
Exemple #4
0
        public async Task <IActionResult> DeleteComment(int id)
        {
            CommentDataModel commentDataModel = this.applicationDbContext.Comments.FirstOrDefault(c => c.Id == id);

            if (!(this.User.FindFirstValue(ClaimTypes.NameIdentifier).Equals(commentDataModel.CreatorId) || this.User.IsInRole("Administrator")))
            {
                return(RedirectToAction("NoAccess", "Home"));
            }

            BlogPostDataModel blogPostDataModel = this.applicationDbContext.BlogPosts.FirstOrDefault(c => c.Id == commentDataModel.BlogPostId);

            blogPostDataModel.Comments -= 1;
            this.applicationDbContext.BlogPosts.Update(blogPostDataModel);

            this.applicationDbContext.Remove(commentDataModel);
            await this.applicationDbContext.SaveChangesAsync();

            BigViewModel bigViewModel = new BigViewModel();

            bigViewModel.BlogPostDataModel = blogPostDataModel;

            return(RedirectToAction("DetailsBlogPost", "Blog", new {
                bigViewModel.BlogPostDataModel.Id,
                bigViewModel
            }));
        }
    public ActionResult Index(BigViewModel model)
    {
        var smallVIewModelInfo  = model.SmallView.Stuff;
        var bigViewModelConfirm = model.Confirm;

        return(View());
    }
Exemple #6
0
        // GET: Menu/Details/5
        public ActionResult Details(int?id)
        {
            var model = new BigViewModel();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            // By making a list we have access to all of the ingredients
            List <Ingredients> ingredients = db.Ingredients.ToList();

            if (ingredients == null)
            {
                return(HttpNotFound());
            }

            // This is allowing us to grab the newly created menu items by id
            Menu menu = db.Menu.Find(id);

            if (menu == null)
            {
                return(HttpNotFound());
            }
            model.Menu        = menu;
            model.Ingredients = ingredients;
            return(View(model));
        }
Exemple #7
0
        public ActionResult Edit(BigViewModel editOrder)
        {
            if (ModelState.IsValid)
            {
                db.Entry(editOrder.Order).State = EntityState.Modified;
                db.SaveChanges();
                //var dbw = db.OrderItem.Where(o => o.OrderId == editOrder.Order.Id);

                foreach (var i in editOrder.orderItemsList)
                {
                    if (i.Id == 0)
                    {
                        i.OrderId = editOrder.Order.Id;
                        db.OrderItem.Add(i);
                    }
                    var d = db.OrderItem.Find(i.Id);
                    d.Name     = i.Name;
                    d.Quantity = i.Quantity;
                    d.Unit     = i.Unit;
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ProviderId = new SelectList(db.Provider, "Id", "Name", editOrder.Order.ProviderId);
            return(View(editOrder));
        }
        // GET: Offer/Details/5
        public ActionResult Details(int id)
        {
            List <String> spec = (new List <String> {
                "Software Engineering", "Graphic Designing", "Front end Developer", "IT Specialist"
            });

            ViewBag.list = spec;

            OfferJobs    offer        = serviceOffer.GetById(id);
            BigViewModel bigViewModel = new BigViewModel();


            OfferViewModel offerViewModel = new OfferViewModel();

            offerViewModel.offerId = id;

            offerViewModel.JobType         = offer.JobType;
            offerViewModel.JobDescription  = offer.JobDescription;
            offerViewModel.JobExperience   = offer.JobExperience;
            offerViewModel.JobRequirements = offer.JobRequirements;
            offerViewModel.offerId         = offer.offerId;
            //OfferViewModel.userId = item.userId;
            offerViewModel.PostedOn       = offer.PostedOn;
            offerViewModel.LastDay        = offer.LastDay;
            offerViewModel.ExpectedSalary = offer.ExpectedSalary;
            bigViewModel.offerViewModel   = offerViewModel;
            JobRequest jobRequestTest = serviceJob.getJobRequest(User.Identity.GetUserId <int>());

            if (jobRequestTest != null)
            {
                ViewBag.Message = "Vous avez deja inscrit";
            }
            return(View(bigViewModel));
        }
Exemple #9
0
        public ActionResult Save_Mapping(BigViewModel bigModel)
        {
            ReportHeader header = new ReportHeader();

            header.ElementSeparator    = (string)Session["ElementSeparator"];
            header.NewlineSeparator    = (string)Session["NewlineSeparator"];
            header.SubElementSeparator = (string)Session["SubElementSeparator"];

            header.Country     = bigModel.ReportHeader.Country;
            header.PartnerName = bigModel.ReportHeader.PartnerName;
            header.ReportType  = bigModel.ReportHeader.ReportType;

            //Insert through EDIFACTMapping
            header.EDI_FileType = "EDIFACT";


            //Load from Session
            if (Session["SegmentInitiator"] != null && Session["SegmentLocation"] != null && Session["FieldName"] != null)
            {
                SegmentInitiator    = (List <string>)Session["SegmentInitiator"];
                SegmentLocation     = (List <int>)Session["SegmentLocation"];
                FieldName           = (List <string>)Session["FieldName"];
                SegmentIdentifier_2 = (List <string>)Session["SegmentIdentifier_2"];
            }

            int id;

            using (EDI_ReportConverterEntities entity = new EDI_ReportConverterEntities())
            {
                entity.ReportHeaders.Add(header);
                entity.SaveChanges();
                id = header.Id;

                for (int i = 0; i < SegmentInitiator.Count; i++)
                {
                    ReportMapping mapping = new ReportMapping();
                    mapping.ReportHeader_Id     = id;
                    mapping.SegmentInitiator    = SegmentInitiator[i];
                    mapping.SegmentLocation     = SegmentLocation[i];
                    mapping.FieldName           = FieldName[i];
                    mapping.SegmentIdentifier_2 = SegmentIdentifier_2[i];

                    entity.ReportMappings.Add(mapping);
                    entity.SaveChanges();
                }
            }


            //validate if ReportHeader fields present (Make all ReportHeader fields mandatory)

            TempData["Message_Save_Mapping_Confirmation"] = "Mapping saved successfully!";

            Session["ReportheaderID"] = id; // Saving id in session. To be used in CriteriaController. Passing data as parameter to RedirecttoAction doesn't work

            //return View("Index");
            //return RedirectToAction("Index", "EDIFACT");  //redirects to upload and convert page
            return(RedirectToAction("Index", "Criteria")); // creating a new criteria that uses the given map header id
        }
Exemple #10
0
 public ActionResult Register(BigViewModel obj)
 {
     if (ModelState.IsValid)
     {
         SMLDBEntities db = new SMLDBEntities();
         db.UserTables.Add(obj.UserTable);
         db.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }
        public ActionResult Index()
        {
            BigViewModel bigModel = new BigViewModel();

            bigModel.PartnerList    = PopulateList("Partner");
            bigModel.CountryList    = PopulateList("Country");
            bigModel.ReportTypeList = PopulateList("ReportType");


            return(View(bigModel));
        }
Exemple #12
0
        // GET: Home
        public ActionResult Index()
        {
            BigViewModel bvm = new BigViewModel
            {
                Albums     = Album.GetAlbumList(),
                Categories = Category.GetCategoriesList(),
                Songs      = Song.GetSongList()
            };

            //albumList = bvm.Albums;
            return(View(bvm));
        }
        public ActionResult Save_Mapping(BigViewModel bigModel)
        {
            ReportHeader header = new ReportHeader();

            header.ElementSeparator    = (string)Session["ElementSeparator"];
            header.NewlineSeparator    = (string)Session["NewlineSeparator"];
            header.SubElementSeparator = (string)Session["SubElementSeparator"];

            header.Country     = bigModel.ReportHeader.Country;
            header.PartnerName = bigModel.ReportHeader.PartnerName;
            header.ReportType  = bigModel.ReportHeader.ReportType;


            //Load from Session
            if (Session["SegmentInitiator"] != null && Session["FieldName"] != null)
            {
                SegmentInitiator    = (List <string>)Session["SegmentInitiator"];
                SegmentLocation     = (List <int>)Session["SegmentLocation"];
                FieldName           = (List <string>)Session["FieldName"];
                SegmentIdentifier_2 = (List <string>)Session["SegmentIdentifier_2"];
            }

            using (EDI_ReportConverterEntities entity = new EDI_ReportConverterEntities())
            {
                entity.ReportHeaders.Add(header);
                entity.SaveChanges();
                int id = header.Id;

                for (int i = 0; i < SegmentInitiator.Count; i++)
                {
                    ReportMapping mapping = new ReportMapping();
                    mapping.ReportHeader_Id  = id;
                    mapping.SegmentInitiator = SegmentInitiator[i];
                    //mapping.SegmentLocation = SegmentLocation[i];
                    mapping.FieldName = FieldName[i];
                    //mapping.SegmentIdentifier_2 = SegmentIdentifier_2[i];

                    entity.ReportMappings.Add(mapping);
                    entity.SaveChanges();
                }
            }


            //validate if ReportHeader fields present (Make all ReportHeader fields mandatory)

            TempData["Message_Save_Mapping_Confirmation"] = "Mapping saved successfully!";


            //return View("Index");
            return(RedirectToAction("Index", "EDIFACT"));
        }
Exemple #14
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            BigViewModel bigViewModel = new BigViewModel();

            bigViewModel.Request    = db.Request.Find(id);
            bigViewModel.Attachment = db.Attachment.FirstOrDefault(c => c.RequestId == id);
            bigViewModel.Status     = db.Status.SingleOrDefault(c => c.Id == id);

            return(View(bigViewModel));
        }
Exemple #15
0
        public IActionResult DetailsBlogPost(int id, BigViewModel bigViewModel)
        {
            bigViewModel.BlogPostDataModel = this.applicationDbContext.BlogPosts.FirstOrDefault(bp => bp.Id == id);

            if (bigViewModel.BlogPostDataModel != null)
            {
                bigViewModel.BlogPostDataModel.Views += 1;
                this.applicationDbContext.BlogPosts.Update(bigViewModel.BlogPostDataModel);
                this.applicationDbContext.SaveChanges();
            }

            bigViewModel.CommentDataModels = this.applicationDbContext.Comments.Where(c => c.BlogPostId == id).ToList();

            return(View(bigViewModel));
        }
Exemple #16
0
        //public string RandomString()
        //{
        //    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        //    var stringChars = new char[10];
        //    var random = new Random();

        //    for (int i = 0; i < stringChars.Length; i++)
        //    {
        //        stringChars[i] = chars[random.Next(chars.Length)];
        //    }

        //    var finalString = new String(stringChars);

        //    return finalString;
        //}

        // GET: AdsViewAdverts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            BigViewModel bigViewModel = new BigViewModel();

            bigViewModel.AdsViewAdverts = db.AdsViewAdverts.Find(id);
            bigViewModel.AdsViewContact = db.AdsViewContacts.FirstOrDefault(c => c.Advert.Id == id);
            bigViewModel.AdsViewFile    = db.AdsViewFile.FirstOrDefault(c => c.AdId == id);

            return(View(bigViewModel));
        }
Exemple #17
0
 public ActionResult Index()
 {
     if (Session["UserID"] != null)
     {
         return(RedirectToAction("Index", "User"));
     }
     else
     {
         SMLDBEntities songs = new SMLDBEntities();
         BigViewModel  bvm   = new BigViewModel();
         bvm.SongTable = new List <SongTable>();
         bvm.SongTable = songs.SongTables.ToList();
         return(View(bvm));
     }
 }
Exemple #18
0
        // GET: RequestList/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            BigViewModel bigViewModel = new BigViewModel();

            bigViewModel.Request    = db.Request.Find(id);
            bigViewModel.Attachment = db.Attachment.FirstOrDefault(c => c.RequestId == id);

            ViewBag.StatusList = db.Status;

            return(View(bigViewModel));
        }
Exemple #19
0
        // GET: Orders/Create
        public ActionResult Create()
        {
            BigViewModel model = new BigViewModel();

            List <OrderItem> orderItemsList = new List <OrderItem>
            {
                new OrderItem {
                    Name = "", Quantity = 0, Unit = ""
                }
            };

            model.orderItemsList = orderItemsList;

            ViewBag.ProviderId = new SelectList(db.Provider, "Id", "Name");
            return(View(model));
        }
Exemple #20
0
        public ActionResult FilterbyPartner(string Value)
        {
            /*
             * TO DO -
             *
             *
             * This function returns cascaded drop down
             */
            EDI_ReportConverterEntities entity = new EDI_ReportConverterEntities();

            List <String> DropdownList = new List <String>();

            DropdownList = entity.ReportHeaders.Where(P => P.PartnerName == Value).Select(c => c.PartnerName).ToList();

            //if (attribute == "Partner")
            //{
            //    DropdownList = entity.ReportHeaders.Select(c => c.PartnerName).ToList();
            //}
            //else if (attribute == "Country")
            //{
            //    //DropdownList = entity.ReportHeaders.Where(c=>c.PartnerName == partnername).Select(c => c.Country).ToList();
            //}
            //else if (attribute == "ReportType")
            //{
            //    DropdownList = entity.ReportHeaders.Select(c => c.ReportType).ToList();
            //}

            //Removing null values from list

            DropdownList.RemoveAll(c => c == null);

            List <SelectListItem> item = DropdownList.ConvertAll(a =>
            {
                return(new SelectListItem()
                {
                    Text = a.ToString(),
                    Value = a.ToString(),
                    Selected = false
                });
            });
            //return View("Index");

            BigViewModel bigModel = new BigViewModel();


            return(RedirectToAction("Index", bigModel));
        }
        public async Task <ActionResult> UsersByOffer(int id)
        {
            List <BigViewModel> list    = new List <BigViewModel>();
            List <Folder>       folders = new List <Folder>();
            List <JobRequest>   jobs    = new List <JobRequest>();

            folders = serviceFolder.GetAll().Where(a => a.etape == 3).ToList();

            foreach (var item in folders)
            {
                jobs = serviceJob.GetAll().Where(a => a.offerId == id && a.jobRequestId == item.jobRequestId).ToList();
            }

            foreach (var item in jobs)
            {
                User user = await UserManager.FindByIdAsync(item.userId);

                UserModel userModel = new UserModel();
                userModel.firstname = user.firstname;
                userModel.lastname  = user.lastname;
                userModel.Email     = user.Email;
                userModel.userId    = user.Id;


                JobRequestModel jobModel = new JobRequestModel();
                jobModel.dateApply    = item.dateApply;
                jobModel.speciality   = item.speciality;
                jobModel.userId       = item.userId;
                jobModel.jobRequestId = item.jobRequestId;
                jobModel.state        = item.state;

                //   Resource user1 = serviceResouce.getResource(user.UserName);



                BigViewModel bg = new BigViewModel();

                bg.resourceViewModel = userModel;


                bg.jobRequestModel = jobModel;

                list.Add(bg);
            }
            return(View(list));
        }
Exemple #22
0
 public ActionResult Login(BigViewModel objUser)
 {
     if (ModelState.IsValid)
     {
         using (SMLDBEntities db = new SMLDBEntities())
         {
             var obj = db.UserTables.Where(a => a.UserName.Equals(objUser.UserTable.UserName) && a.Password.Equals(objUser.UserTable.Password)).FirstOrDefault();
             if (obj != null)
             {
                 Session["UserID"]   = obj.UserID.ToString();
                 Session["UserName"] = obj.UserName.ToString();
                 Session["Email"]    = obj.Email.ToString();
                 return(RedirectToAction("Index", "User"));
             }
         }
     }
     return(RedirectToAction("Index", "Home"));
 }
        public IActionResult About(BigViewModel viewModel)
        {
            var item = new QuestionModel
            {
                QuestionId   = Guid.NewGuid(),
                QuestionText = viewModel.AddViewModel.QuestionText
            };

            _questionService.AddQuestion(item);

            var answer1 = new AnswerModel
            {
                AnswerId   = Guid.NewGuid(),
                AnswerText = viewModel.AddViewModel.Answer1,
                QuestionId = item.QuestionId
            };

            _answerService.AddAnswer(answer1);

            if (viewModel.AddViewModel.Answer2 != null)
            {
                var answer2 = new AnswerModel
                {
                    AnswerId   = Guid.NewGuid(),
                    AnswerText = viewModel.AddViewModel.Answer2,
                    QuestionId = item.QuestionId
                };
                _answerService.AddAnswer(answer2);
            }

            if (viewModel.AddViewModel.Answer3 != null)
            {
                var answer3 = new AnswerModel
                {
                    AnswerId   = Guid.NewGuid(),
                    AnswerText = viewModel.AddViewModel.Answer3,
                    QuestionId = item.QuestionId
                };
                _answerService.AddAnswer(answer3);
                _answerService.Dispose();
            }

            return(RedirectToAction("Index"));
        }
Exemple #24
0
        public ActionResult Step1(BigViewModel model)
        {
            if (model.User.userID == 0)
            {
                Role role = db.Roles.ToList()[0];
                model.User.roleID = role.ID;
                FormsAuthentication.SignOut();
                db.Users.Add(model.User);
                db.SaveChanges();
                //Шинээр бүртгүүлсэн хэрэглэгчийг системд нэвтрүүлж байна
                FormsAuthentication.SetAuthCookie(model.User.email, false);

                var    authTicket      = new FormsAuthenticationTicket(1, model.User.email, DateTime.Now, DateTime.Now.AddMinutes(20), false, model.User.role.name);
                string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                var    authCookie      = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                HttpContext.Response.Cookies.Add(authCookie);
            }
            return(RedirectToAction("Step2", new { id = model.Hotel.hotelID }));
        }
Exemple #25
0
        public ActionResult Create(BigViewModel createOrder)
        {
            if (ModelState.IsValid)
            {
                db.Order.Add(createOrder.Order);
                db.SaveChanges();
                //createOrder.OrderItem.OrderId = createOrder.Order.Id;
                //db.OrderItem.Add(createOrder.OrderItem);
                foreach (var i in createOrder.orderItemsList)
                {
                    i.OrderId = createOrder.Order.Id;
                    db.OrderItem.Add(i);
                }
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }


            ViewBag.ProviderId = new SelectList(db.Provider, "Id", "Name", createOrder.Order.ProviderId);
            return(View(createOrder));
        }
Exemple #26
0
        public ActionResult Step1(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Hotel hotel = db.Hotels.Find(id);

            if (hotel == null)
            {
                return(HttpNotFound());
            }
            BigViewModel bigModel = new BigViewModel();

            bigModel.Hotel = hotel;
            if (Request.IsAuthenticated)
            {
                User user = db.Users.Where(o => o.email == HttpContext.User.Identity.Name).ToList()[0];
                bigModel.User = user;
            }
            return(View(bigModel));
        }
        // GET: Default
        public ActionResult AlbumListByCategory(int categoryID, string sortBy)
        {
            ViewBag.SortAlbumNameParameter = string.IsNullOrEmpty(sortBy) ? "AlbumName desc" : "";
            ViewBag.SortBandNameParameter  = sortBy == "BandName" ? "BandName desc" : "BandName";

            var albumsWithCategory = (from album in Album.GetAlbumList()
                                      join category in Category.GetCategoriesList()
                                      on album.CategoryID equals category.CategoryID
                                      where (categoryID == album.CategoryID)
                                      select album).ToList().AsQueryable();

            switch (sortBy)
            {
            case "AlbumName desc":
                albumsWithCategory = albumsWithCategory.OrderByDescending(x => x.AlbumName);
                break;

            case "BandName desc":
                albumsWithCategory = albumsWithCategory.OrderByDescending(x => x.BandName);
                break;

            case "BandName":
                albumsWithCategory = albumsWithCategory.OrderBy(x => x.BandName);
                break;

            default:
                albumsWithCategory = albumsWithCategory.OrderBy(x => x.AlbumName);
                break;
            }

            BigViewModel bvm = new BigViewModel
            {
                Albums     = albumsWithCategory,
                Categories = Category.GetCategoriesList(),
                Songs      = Song.GetSongList()
            };

            return(View(bvm));
        }
Exemple #28
0
        // GET: Orders/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BigViewModel model = new BigViewModel();

            //var orders = db.Order.Include(o => o.Provider).Include(o => o.OrderItem);
            //model.Order = orders.Where(o=>o.Id.Equals(id));
            model.Order = db.Order.Include(o => o.Provider).Include(o => o.OrderItem).FirstOrDefault(x => x.Id == id);

            //model.Order =
            if (model.Order == null)
            {
                return(HttpNotFound());
            }

            model.orderItemsList = model.Order.OrderItem.ToList();

            ViewBag.ProviderId = new SelectList(db.Provider, "Id", "Name", model.Order.ProviderId);
            return(View(model));
        }
        public async Task <ActionResult> Index()
        {
            BigViewModel big = new BigViewModel();

            //get details  user Connec


            string username = User.Identity.GetUserName();
            User   user     = await UserManager.FindByEmailAsync(username);

            UserModel model = new UserModel();

            model.userId  = user.Id;
            model.address = user.address;

            model.Email           = user.Email;
            model.firstname       = user.firstname;
            model.lastname        = user.lastname;
            model.phoneNumber     = user.PhoneNumber;
            big.resourceViewModel = model;

            //////////////////////

            JobRequest      jobrequest = serviceJobRequest.GetAll().Where(a => a.userId == User.Identity.GetUserId <int>()).SingleOrDefault();
            Folder          folder     = serviceFolder.GetAll().Where(a => a.jobRequestId == jobrequest.jobRequestId).SingleOrDefault();
            FolderViewModel folerModel = new FolderViewModel();

            folerModel.folderId   = folder.folderId;
            folerModel.typeTest   = folder.typeTest;
            folerModel.testResult = folder.testResult;
            folerModel.state      = folder.state;
            folerModel.etape      = folder.etape;

            big.folderViewModel = folerModel;

            return(View(big));
        }
        public JsonResult GetSearchingData(int categoryID, string searchBy, string searchValue)
        {
            BigViewModel bvm;

            if (searchBy == "AlbumName")
            {
                var albumsWithCategory = (from album in Album.GetAlbumList()
                                          join category in Category.GetCategoriesList()
                                          on album.CategoryID equals category.CategoryID
                                          where (categoryID == album.CategoryID)
                                          select album).Where(x => x.AlbumName.
                                                              StartsWith(searchValue, StringComparison.InvariantCultureIgnoreCase) ||
                                                              searchValue == "")
                                         .ToList();
                bvm = new BigViewModel()
                {
                    Albums = albumsWithCategory
                };
                return(Json(albumsWithCategory, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var albumsWithCategory = (from album in Album.GetAlbumList()
                                          join category in Category.GetCategoriesList()
                                          on album.CategoryID equals category.CategoryID
                                          where (categoryID == album.CategoryID)
                                          select album).Where(x => x.BandName.
                                                              StartsWith(searchValue, StringComparison.InvariantCultureIgnoreCase) ||
                                                              searchValue == "")
                                         .ToList();
                bvm = new BigViewModel()
                {
                    Albums = albumsWithCategory
                };
                return(Json(albumsWithCategory, JsonRequestBehavior.AllowGet));
            }
        }