Example #1
0
        public ActionResult DetayList(int id)
        {
            PersonelRepository personelRepository = new PersonelRepository();
            PersonelViewModel  model         = new PersonelViewModel();
            Personell          personel      = personelRepository.FirstOrDefault(x => x.PersonellId == id);
            DepartmanEnum      departmanEnum = (DepartmanEnum)personel.Departman;

            model.DepartmanAd = EnumerationHelper.GetDescription <DepartmanEnum>(departmanEnum);

            model.Ad          = personel.Ad;
            model.Soyad       = personel.Soyad;
            model.Departman   = personel.Departman.Value;
            model.İzinGunu    = personel.İzinGunu.Value;
            model.PersonellId = id;

            return(View(model));
        }
Example #2
0
        public async Task <IActionResult> Index(HotelFile model)
        {
            if (ModelState.IsValid)
            {
                if (model == null ||
                    model.FileToUpload == null || model.FileToUpload.Length == 0)
                {
                    return(Content("file not selected"));
                }

                var path = Path.Combine(
                    Directory.GetCurrentDirectory(), "wwwroot/uploadedfiles",
                    model.FileToUpload.GetFilename());

                using (var stream = new FileStream(path, FileMode.Create))
                {
                    await model.FileToUpload.CopyToAsync(stream);
                }

                var hotelList = _reader.ReadFile(path);

                var description   = EnumerationHelper.GetDescription((FileStorageType)model.SelectedFileStorageType);
                var sortingOption = EnumerationHelper.GetDescription((TransactionOptionType)model.SelectedSortGroup);

                var orderedHotelList = FileHelper.ToOrderedList(hotelList as IList <Hotel>, sortingOption);

                var writer      = FileWriterCreator.GetFileWriter(description);
                var newFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/uploadedfiles", $"{description.TrimStart('.')}File{description}");

                writer.WriteFile(hotelList, newFilePath);
            }
            else
            {
                if (model == null ||
                    model.FileToUpload == null || model.FileToUpload.Length == 0)
                {
                    return(Content("file not selected"));
                }
            }
            return(View());
        }
Example #3
0
        public ActionResult List(List <PersonelViewModel> list)
        {
            PersonelRepository       repository = new PersonelRepository();
            List <PersonelViewModel> _list      = new List <PersonelViewModel>();

            list = _list.ToList();

            IQueryable <Personell> personel = repository.GetAll();

            foreach (var item in personel)
            {
                DepartmanEnum     departmanEnum = (DepartmanEnum)item.Departman;
                PersonelViewModel model         = new PersonelViewModel()
                {
                    PersonellId = item.PersonellId,
                    Ad          = item.Ad,
                    Soyad       = item.Soyad,
                    İzinGunu    = item.İzinGunu.Value,
                    Departman   = item.Departman.Value,
                    DepartmanAd = EnumerationHelper.GetDescription <DepartmanEnum>(departmanEnum)
                }; list.Add(model);
            }
            return(View(list));
        }