public ActionResult Logout()
 {
     ToastrService.AddToUserQueue(new Toastr("Başarılı Bir Şekilde Gerçekleşti", "Çıkış Yapıldı", ToastrType.Info));
     FormsAuthentication.SignOut();
     Session.Abandon();
     return(RedirectToAction("Login"));
 }
示例#2
0
        public async Task <IActionResult> CreateService(ServiceModel model, IFormFile file)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var entity = new Service();

            if (file != null)
            {
                entity.ImageUrl = file.FileName;
                var path = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\img\about\service", file.FileName);
                using (var stream = new FileStream(path, FileMode.Create))
                    await file.CopyToAsync(stream);
            }

            entity.Title       = model.Title;
            entity.Description = model.Description;

            if (_aboutServicesService.Create(entity))
            {
                ToastrService.AddToUserQueue(new Toastr()
                {
                    Message    = Toastr.GetMessage("Servis"),
                    Title      = Toastr.GetTitle("Servis"),
                    ToastrType = ToastrType.Success
                });

                return(View(new ServiceModel()));
            }

            ViewBag.ErrorMessage = _aboutServicesService.ErrorMessage;
            return(View(model));
        }
示例#3
0
        public IActionResult CreateProduct(ProductModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var entity = new Product()
            {
                Name        = model.Name,
                ImageUrl    = model.ImageUrl == null ? "urun-resim-yok.png" : model.ImageUrl,
                Description = model.Description,
                Price       = model.Price
            };

            if (_productService.Create(entity))
            {
                ToastrService.AddToUserQueue(new Toastr()
                {
                    Message    = Toastr.GetMessage("Ürün"),
                    Title      = Toastr.GetTitle("Ürün"),
                    ToastrType = ToastrType.Success
                });

                return(View(new ProductModel()));
            }

            ViewBag.ErrorMessage = _productService.ErrorMessage;
            return(View(model));
        }
        public ActionResult Login(FormCollection form)
        {
            string loginNo  = form["loginNo"];
            string password = form["Password"];
            string role     = form["role"];

            if (Login(loginNo, password, role))
            {
                ToastrService.AddToUserQueue(new Toastr("Sisteme başarılı bir şekilde giriş yapıldı", "Hoşgeldiniz", ToastrType.Success));
                TempData["login"] = "******";
                if (role == "doctor")
                {
                    return(RedirectToAction("Recipes", "Doctor"));
                }


                else if (role == "pharmacy")
                {
                    return(RedirectToAction("Recipes", "Pharmacy"));
                }

                else if (role == "patient")
                {
                    return(RedirectToAction("Recipes", "Patient"));
                }
            }
            else
            {
                ToastrService.AddToUserQueue(new Toastr("Lütfen giriş bilgilerinizi kontrol ediniz ", "Giriş Yapılamadı", ToastrType.Error));
            }

            return(View());
        }
        public ActionResult Login(FormCollection form)
        {
            string Username = form["username"];
            string Password = form["password"];
            string Role     = form["role"];

            if (LoginControl(Username, Password, Role))
            {
                if (Role == "T")
                {
                    return(RedirectToAction("Index", "Teacher"));
                }
                else if (Role == "S")
                {
                    return(RedirectToAction("Index", "Student"));
                }
                else
                {
                    ToastrService.AddToUserQueue("Lütfen giriş bilgilerinizi kontrol ediniz ", "Giriş Yapılamadı", ToastrType.Error);
                    return(View());
                }
            }
            ToastrService.AddToUserQueue("Lütfen giriş bilgilerinizi kontrol ediniz ", "Giriş Yapılamadı", ToastrType.Error);
            return(View());
        }
        public bool LoginControl(string Username, string Password, string Role)
        {
            var user = context.Users.FirstOrDefault(x => x.Username == Username && x.Password == Password && x.Role == Role);

            if (user != null)
            {
                if (Role == "T")
                {
                    int teacherID = context.Teachers.FirstOrDefault(x => x.UserId == user.Id).Id;

                    FormsAuthentication.SetAuthCookie(user.Username.ToString(), false);
                    Session["username"]  = Username;
                    Session["TeacherId"] = teacherID;
                    ToastrService.AddToUserQueue(null, "Giriş Başarılı", ToastrType.Success);
                    return(true);
                }
                else if (Role == "S")
                {
                    int studentID = context.Students.FirstOrDefault(x => x.UserId == user.Id).Id;
                    FormsAuthentication.SetAuthCookie(user.Username.ToString(), false);
                    Session["username"]  = Username;
                    Session["StudentId"] = studentID;
                    ToastrService.AddToUserQueue(null, "Giriş Başarılı", ToastrType.Success);
                    return(true);
                }
            }
            return(false);
        }
示例#7
0
        public IActionResult CreateSlider(SliderModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var entity = new Slider()
            {
                Title       = model.Title,
                ImageUrl    = model.ImageUrl,
                Description = model.Description,
            };

            if (_sliderService.Create(entity))
            {
                ToastrService.AddToUserQueue(new Toastr()
                {
                    Message    = "Slider Eklendi",
                    Title      = "Kayıt Ekleme",
                    ToastrType = ToastrType.Success
                });

                return(View(new SliderModel()));
            }


            ViewBag.ErrorMessage = _sliderService.ErrorMessage;
            return(View(model));
        }
示例#8
0
        public async Task <IActionResult> CreateBanner(IFormFile file)
        {
            if (file != null)
            {
                var entity = new BannerImage()
                {
                    ImageUrl = file.FileName
                };

                var path = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\img\banner", file.FileName);
                using (var stream = new FileStream(path, FileMode.Create))
                    await file.CopyToAsync(stream);

                if (_bannerImageService.Create(entity))
                {
                    ToastrService.AddToUserQueue(new Toastr()
                    {
                        Message    = Toastr.GetMessage("Banner Resmi"),
                        Title      = Toastr.GetTitle("Banner"),
                        ToastrType = ToastrType.Success
                    });

                    return(RedirectToAction("BannerList"));
                }
            }

            ViewBag.ErrorMessage = _bannerImageService.ErrorMessage;
            return(RedirectToAction("BannerList"));
        }
        public IActionResult Index(RegisterViewModel model)
        {
            if (_cookieService.checkUserLogin())
            {
                return(Redirect("~/anasayfa"));
            }
            model.termsconditionMessage = _defaultValuesService.getDefaultValue("uyeliksozlesmesi");
            if (model.termscondition)
            {
                if (_usersService.registerUser(model))
                {
                    UsersViewModel registeredModel = _usersService.getUserInformation(model.userEmailAdress);
                    registeredModel.accessToken = _usersService.getUserToken(Model.Enums.UsersTokenTypeEnum.register, registeredModel.userId);
                    if (_emailService.sendEmail(_emailService.sendRegisterEmail(registeredModel)))
                    {
                        model.userId = registeredModel.userId;
                    }
                    model.isRegistered = true;
                }
            }
            else
            {
                ToastrService.AddToUserQueue(new Toastr("Lütfen üyelik sözleşmesini okuyup onaylanyınız.", type: Model.Enums.ToastrType.Warning));
            }

            return(View(model));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Customer customer = db.Customers.Find(id);

            db.Customers.Remove(customer);
            db.SaveChanges();

            ToastrService.AddToUserQueue(new Toastr(message: "Customer deleted.", type: ToastrType.Error));

            return(RedirectToAction("Index"));
        }
        public ActionResult Exam(CevapModel cevapModel)
        {
            //Giris Yapmıs Ogrenci ID'si
            int ogrID = Convert.ToInt32(Session["ogrenciID"]);

            //Giris Yapmıs Ogrencinin Ogretmen ID'si
            var ogr = db.Ogrenci.FirstOrDefault(x => x.ogrenciID.Equals(ogrID));
            var id  = ogr.ogrenciOgrID;

            //Ogrencinin Ogretmeninin ekledigi sorulardan 10 tane getirme
            // Ogrencinin Ogretmeninin ekledigi sorulardan 10 tane getirme
            //var sorular = db.Soru.Where(x => x.soruOgretmenID.Equals(id)).Take(10).ToList();

            for (int i = 2; i < 8; i++)
            {
                db.sonCevaplar.FirstOrDefault(x => x.id.Equals(i)).yanlisAdeti = 0;
            }

            Sinav sinav = new Sinav();

            sinav.sinavTarih   = DateTime.Now;
            sinav.ogrenciID    = ogrID;
            sinav.sinavID      = 0;
            sinav.sinavSonuc   = 0;
            sinav.dersID       = 1;
            sinav.yanlisSayisi = 0;
            sinav.dogruSayisi  = 0;

            //Kullanıcının Sectigi Cevapları Alma

            foreach (var cevap in cevapModel.cevaplar)
            {
                Soru soru = db.Soru.FirstOrDefault(x => x.soruID.Equals(cevap.soruId));

                if (soru != null && soru.soruID == cevap.soruId)
                {
                    if (soru.soruCevap.Equals(cevap.verilenCevap))
                    {
                        sinav.dogruSayisi++;
                    }
                    else if (cevap.verilenCevap != null)
                    {
                        sinav.yanlisSayisi++;
                        db.sonCevaplar.FirstOrDefault(x => x.id.Equals(soru.soruKonuID)).yanlisAdeti++;
                    }
                }
            }

            db.Sinav.Add(sinav);
            db.SaveChanges();

            ToastrService.AddToUserQueue(new Toastr("Sınav Tamamlandı.", "Sınav Bitti.", ToastrType.Info));
            return(RedirectToAction("Index", "Student"));
        }
示例#12
0
        public IActionResult DeleteFromCategory(int productId, int categoryId)
        {
            _categoryService.DeleteFromCategory(categoryId, productId);

            ToastrService.AddToUserQueue(new Toastr()
            {
                Message    = "Seçili Ürün Mevcut Kategoriden Silindi",
                Title      = "Kategoriden Ürün Silme",
                ToastrType = ToastrType.Error
            });

            return(Redirect($"/product/editcategory/{categoryId}"));
        }
 public IActionResult resendMail(Guid userId)
 {
     if (_usersService.createUserToken(Model.Enums.UsersTokenTypeEnum.register, userId) != null)
     {
         UsersViewModel registeredModel = _usersService.getUserInformationFromId(userId);
         registeredModel.accessToken = _usersService.getUserToken(Model.Enums.UsersTokenTypeEnum.register, registeredModel.userId);
         if (_emailService.sendEmail(_emailService.sendRegisterEmail(registeredModel)))
         {
             ToastrService.AddToUserQueue(new Toastr("Kayıt işlemlerini tamamlamak için posta hesabınıza gelen maili açınız.", type: Model.Enums.ToastrType.Success));
         }
     }
     return(Redirect("~/giris"));
 }
示例#14
0
 public ActionResult Detail(productsViewModel model)
 {
     if (_productService.updateProductDetail(model))
     {
         ToastrService.AddToUserQueue("Ürün başarıyla güncellendi.", "Kuaför Store", Data.Enums.ToastrType.Success);
         return(Redirect("~/urun-listesi"));
     }
     else
     {
         ToastrService.AddToUserQueue("Ürün bilgilerinde hata oluştu.", "Kuaför Store", Data.Enums.ToastrType.Error);
         return(View(model));
     }
 }
示例#15
0
 public ActionResult Create(productsViewModel model)
 {
     if (_productService.saveNewProduct(model) != 0)
     {
         ToastrService.AddToUserQueue("Ürün başarıyla oluşturuldu.", "Kuaför Store", Data.Enums.ToastrType.Success);
         return(Redirect("~/urun-listesi"));
     }
     else
     {
         ToastrService.AddToUserQueue("Ürün bilgilerinde hata oluştu.", "Kuaför Store", Data.Enums.ToastrType.Error);
         return(View(model));
     }
 }
示例#16
0
        public ActionResult Create(FormCollection form)
        {
            string   name      = form["name"];
            int      teacherId = GetTeacherID();
            Category category  = new Category()
            {
                Name = name, TeacherId = teacherId
            };

            context.Categories.Add(category);
            context.SaveChanges();
            ToastrService.AddToUserQueue(new Toastr("Kategori Eklendi", null, ToastrType.Success));
            return(RedirectToAction("Create", "Question"));
        }
        public ActionResult Create(Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();

                ToastrService.AddToUserQueue(new Toastr(message: "Customer added.", type: ToastrType.Success));

                //return RedirectToAction("Index");
            }

            return(View(customer));
        }
        public ActionResult Edit(Customer customer)
        {
            if (ModelState.IsValid)
            {
                ToastrService.AddToUserQueue(new Toastr(message: "Customer updating.", type: ToastrType.Warning));

                db.Entry(customer).State = EntityState.Modified;
                db.SaveChanges();

                ToastrService.AddToUserQueue(new Toastr(message: "Customer updated.", type: ToastrType.Success));

                return(RedirectToAction("Index"));
            }
            return(View(customer));
        }
        public ActionResult Recipes(FormCollection form)
        {
            string recipeID = form["recipeID"].ToString();

            var result = ApiConnect.Post("/recipeDeliver", new Dictionary <string, string>
            {
                { "RecipeID", recipeID }
            });

            if (result.Result.ToString() == "1")
            {
                ToastrService.AddToUserQueue(new Toastr("Başarılı Bir Şekilde Gerçekleşti", "Teslim Bildirildi", ToastrType.Info));
                return(RedirectToAction("Recipes", "Patient"));
            }
            return(RedirectToAction("Recipes", "Patient"));
        }
        public ActionResult Exam()
        {
            //Giris Yapmıs Ogrenci ID'si
            int ogrID = Convert.ToInt32(Session["ogrenciID"]);

            if (ogrID.Equals(0))
            {
                RedirectToAction("Index", "Home");
            }
            //Giris Yapmıs Ogrencinin Ogretmen ID'si
            var ogr = db.Ogrenci.FirstOrDefault(x => x.ogrenciID.Equals(ogrID));
            var id  = ogr.ogrenciOgrID;

            //Sorulari en son girlilen teste göre dengeli bir şekilde hazırlar.
            List <Denge> dengeler = dengele();

            //18 soru öğrencinin sevyesine göre getiriliyor. yanlış yaptığı konulara ağırlık veriliyor.
            List <Soru> sorular = new List <Soru>();

            for (int i = 2; i < 8; i++)
            {
                int konuID = dengeler[i - 2].knID;
                int sayi   = dengeler[i - 2].soruSayisi;

                IEnumerable <Soru> kn = db.Soru.Where(
                    x => x.soruKonuID.Equals(konuID) &&
                    x.soruSeviye < ogr.ogrenciSeviye)
                                        .Take(sayi).ToList();

                sorular.AddRange(kn);
            }

            //18 soru rasgele öğrenci sevyesine göre getiriliyor. yanlış yaptığı konulara ağırlık veriliyor.
            int soruSeviye = 0;

            for (int i = 2; i < 8; i++)
            {
                soruSeviye = new Random().Next(0, 0);
                IEnumerable <Soru> kn = db.Soru.Where(x => x.soruKonuID.Equals(i) && x.soruSeviye.Equals(soruSeviye)).Take(3).ToList();
                sorular.AddRange(kn);
            }

            ToastrService.AddToUserQueue(new Toastr("Sorular Yüklendi.", "Sınav Sistemi", ToastrType.Info));

            //Sınav Sayfası Açılırken Soruların Goruntulenmesi icin View'e model olarak yolluyoruz.
            return(View(sorular));
        }
        public ActionResult WriteRecipe(FormCollection form)
        {
            ApiOperation reOP     = ApiOperation.GetInstance();
            string       doctorId = GetDoctorID().ToString();

            var result = ApiConnect.Post("/createrecipefordoctor", new Dictionary <string, string>
            {
                { "doctorId", doctorId.ToString() },
                { "tcNo", form["txtTcNo"] }
            });

            if (Convert.ToInt16(result.Result) == -1)
            {
                ToastrService.AddToUserQueue(new Toastr("Hasta Bulunamadı", "Reçete Yazılamadı.", ToastrType.Error));
                return(RedirectToAction("Recipes", "Doctor"));
            }

            int i = Convert.ToInt32(form["counter"]);

            for (int j = 1; j <= i; j++)
            {
                string medName, medType, medUsage;

                medName  = form["txtMedName" + j];
                medType  = form["txtMedType" + j];
                medUsage = form["txtMedUsage" + j];

                var result2 = ApiConnect.Post("/addmedicinetorecipefordoctor", new Dictionary <string, string>
                {
                    { "medName", medName },
                    { "medType", medType },
                    { "medUsage", medUsage }
                });
            }

            if (Convert.ToInt32(result.Result) == 0)
            {
                ToastrService.AddToUserQueue(new Toastr("Reçete Başarılı Bir Şekilde Eklendi", "Reçete Yazıldı.", ToastrType.Success));
                return(RedirectToAction("Recipes", "Doctor", new { @id = doctorId }));
            }
            else
            {
                ToastrService.AddToUserQueue(new Toastr("Reçete Eklenemedi", "Reçete Yazılamadı.", ToastrType.Error));
            }

            return(null);
        }
示例#22
0
 public IActionResult Index(Guid userId)
 {
     if (!_cookieService.checkAdminState(Model.Enums.UserRoleEnum.supervisor))
     {
         return(Redirect("~/anasayfa"));
     }
     ;
     if (_usersService.forgetPassSend(_usersService.getUserInformationFromId(userId).userEmailAdress))
     {
         ToastrService.AddToUserQueue(new Toastr("Şifre sıfırlama bilgileri kullanıcıya iletilmiştir.", type: Model.Enums.ToastrType.Success));
     }
     else
     {
         ToastrService.AddToUserQueue(new Toastr("Şifre sıfırlama iletisi gönderilirken bir hata oluştu.Lütfen tekrar deneyiniz.", type: Model.Enums.ToastrType.Error));
     }
     return(Redirect("~/admin/kullanicilari-yonet"));
 }
示例#23
0
        public IActionResult DeleteSlider(int id)
        {
            var entity = _sliderService.GetById(id);

            if (entity != null)
            {
                _sliderService.Delete(entity);
                ToastrService.AddToUserQueue(new Toastr()
                {
                    Message    = "Slider Silindi",
                    Title      = "Kayıt Silme",
                    ToastrType = ToastrType.Error
                });
            }

            return(RedirectToAction("SliderList"));
        }
示例#24
0
        public ActionResult OgretmenGiris(FormCollection form)
        {
            var kullanici = KullaniciGetir(form);

            if (kullanici != null && kullanici.kullaniciTur.Equals(true))
            {
                var ogretmen = db.Ogretmen.FirstOrDefault(x => x.kullaniciID.Equals(kullanici.kullaniciID));
                Session.Add("ogretmenID", ogretmen.ogretmenID);
                ToastrService.AddToUserQueue(new Toastr("Başarılı Bir şekilde Giriş Yapıldı.", "Giriş Durumu", ToastrType.Success));
                return(RedirectToAction("Index", "Teacher"));
            }
            else
            {
                ToastrService.AddToUserQueue(new Toastr("Giriş Yapılamadı!", "Giriş Durumu", ToastrType.Error));
                return(RedirectToAction("Index", "Home"));
            }
        }
        public ActionResult Settings(FormCollection form)
        {
            string pharmacyId = form["PharmacyList"].ToString();
            string patientId  = GetPatientId().ToString();

            var result = ApiConnect.Post("/changePharmacy", new Dictionary <string, string>
            {
                { "PatientID", patientId },
                { "PharmacyID", pharmacyId }
            });

            if (result.Result.ToString() == "1")
            {
                ToastrService.AddToUserQueue(new Toastr("Başarılı Bir Şekilde Gerçekleşti", "Eczane Değiştirildi", ToastrType.Info));
                return(RedirectToAction("Recipes", "Patient"));
            }
            return(RedirectToAction("Recipes", "Patient"));
        }
示例#26
0
        public IActionResult CreateCategory(CategoryModel model)
        {
            var entity = new Category()
            {
                Name = model.Name
            };

            _categoryService.Create(entity);

            ToastrService.AddToUserQueue(new Toastr()
            {
                Message    = Toastr.GetMessage("Kategori"),
                Title      = Toastr.GetTitle("Kategori"),
                ToastrType = ToastrType.Success
            });

            return(View());
        }
示例#27
0
        public IActionResult DeleteCategory(int id)
        {
            var entity = _categoryService.GetById(id);

            if (entity != null)
            {
                _categoryService.Delete(entity);

                ToastrService.AddToUserQueue(new Toastr()
                {
                    Message    = Toastr.GetMessage("Kategori", EntityStatus.Delete),
                    Title      = Toastr.GetTitle("Kategori", EntityStatus.Delete),
                    ToastrType = ToastrType.Error
                });
            }

            return(RedirectToAction("CategoryList"));
        }
示例#28
0
        public ActionResult Create(createInvoiceViewModel model)
        {
            model = _InvoicesService.addNewInvoice(model);
            if (!model.result)
            {
                ToastrService.AddToUserQueue("Kayıt sırasında bir hata oluşmuştur.", "Kuaför Store", Data.Enums.ToastrType.Error);
                model.ownProducts = new productsListViewModel();
                model.ownProducts = _productService.getProductsList();
                return(View(model));
            }

            return(new Rotativa.ViewAsPdf("Print", model)
            {
                PageOrientation = Rotativa.Options.Orientation.Landscape,
                PageSize = Rotativa.Options.Size.A4,
                PageMargins = new Rotativa.Options.Margins(0, 0, 0, 0)
            });
        }
        // GET: Exam
        public ActionResult TakeTheExam()
        {
            int         studentId = GetStundetId();
            List <Exam> exams     = GetExamsWithStudentId(studentId);

            if (exams.Count > 0)
            {
                DateTime lastDate = exams.OrderByDescending(x => x.Id).ToList()[0].Date;

                if (!IsToday(lastDate))
                {
                    int teacherIdForStudent = GetTeacherIDForStudent();

                    int totalCategory = _context.Categories.Count(x => x.TeacherId == teacherIdForStudent);

                    List <PerformanceCategory> performance = GetPerformanceCategoriesForStudent(studentId);

                    int[] categoryIds = GetAscendingRateCategoryIdsForExam(performance);

                    int[] countOfQuestion = GetDescendingCountOfQuestions(totalCategory);

                    List <Question> questions =
                        GetFiftyQuestionsWithTeacherIdAndCategoryId(teacherIdForStudent, categoryIds, countOfQuestion);

                    MatchQuestionsToCategoryId(questions, categoryIds, countOfQuestion, false);

                    ShuffleList(questions);

                    return(View(questions));
                }
            }
            else
            {
                int teacherIdForStudent = GetTeacherIDForStudent();

                List <Question> questions = GetFiftyRandomQuestionWithTeacherId(teacherIdForStudent);

                MatchQuestionsToCategoryId(questions, null, null, true);

                return(View(questions));
            }
            ToastrService.AddToUserQueue("En son yaptığınız sınavın üzerinden en az 1 gün geçmeli.", "Sınav Olamazsınız", ToastrType.Info);
            return(RedirectToAction("Index", "Student"));
        }
示例#30
0
        public IActionResult DeleteBanner(int id)
        {
            var entity = _bannerImageService.GetById(id);

            if (entity == null)
            {
                return(NotFound());
            }

            _bannerImageService.Delete(entity);
            ToastrService.AddToUserQueue(new Toastr()
            {
                Message    = Toastr.GetMessage("Banner Resmi", EntityStatus.Delete),
                Title      = Toastr.GetTitle("Banner", EntityStatus.Delete),
                ToastrType = ToastrType.Error
            });

            return(RedirectToAction("BannerList"));
        }