public ActionResult Edit([Bind(Include = "Id,Name,Description,Image")] Advertize advertize, HttpPostedFileBase uploadImage, string Enabled)
        {
            if (ModelState.IsValid)
            {
                if (Enabled != null && Enabled.Equals("on"))
                {
                    advertize.Enabled = true;
                }
                if (uploadImage != null)
                {
                    byte[] imageData = null;
                    // считываем переданный файл в массив байтов
                    using (var binaryReader = new BinaryReader(uploadImage.InputStream))
                    {
                        imageData = binaryReader.ReadBytes(uploadImage.ContentLength);
                    }
                    // установка массива байтов
                    advertize.Image     = imageData;
                    advertize.ImageType = uploadImage.ContentType;
                }

                db.Entry(advertize).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(advertize));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "Id,Title,Addres,Phone,Email")] CertificationProvider certificationprovider)
 {
     if (ModelState.IsValid)
     {
         db.Entry(certificationprovider).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(certificationprovider));
 }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "Id,Title,ArticleId,Description,Type,ParentId,HeadHunterId,HeadHunterName,HeadHunterKeys")] Qualification qualification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(qualification).State = EntityState.Modified;
         db.SaveChanges();
         return(PartialView("Details", qualification));
     }
     return(PartialView(qualification));
 }
 public ActionResult Edit([Bind(Include = "Id,Time,Duration,IdObject")] Lesson lesson)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lesson).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(lesson));
 }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "Id,Title,ShortDescription,Hourse,MoodleId,PriceForOrganizations,PriceForIndividuals,CostOfOneHourForOrganizations,CostOfOneHourForIndividuals,LevelOfDifficulty,RequiredPreliminaryPreparation,MandatoryPreliminaryPreparation,IdTraningCenter,IdObject")] TrainingCours trainingcours)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trainingcours).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(trainingcours));
 }
 public ActionResult Edit([Bind(Include = "Id,IdStudent,IdTrainingCourse,Status,AmountPaid,Debt,Description,IdObecjt")] CourseTaking coursetaking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(coursetaking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(coursetaking));
 }
 public ActionResult Edit([Bind(Include = "Id,IdProvider,Title,Description")] Certification certification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(certification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdProvider = new SelectList(db.CertificationProviders, "Id", "Title", certification.IdProvider);
     return(View(certification));
 }
Exemple #8
0
 public ActionResult Edit([Bind(Include = "Id,Title,ShortDescription,Numbers,Hours,Topics,IdTrainingCenter")] TrainingModule trainingmodule)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trainingmodule).State = EntityState.Modified;
         db.SaveChanges();
         int?tcId = db.CourseModules.Where(a => a.IdTrainingModule == trainingmodule.Id).First().IdTrainingCourse;
         return(RedirectToAction("Details", "TrainingCours", new { id = tcId }));
     }
     return(View(trainingmodule));
 }
Exemple #9
0
 public ActionResult Edit([Bind(Include = "Id,Title,Description")] FileDocument fileDocument)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fileDocument).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Details", "Article", new { id = fileDocument.ArticleId }));
     }
     ViewBag.ArticleId = new SelectList(db.Articles, "Id", "Title", fileDocument.ArticleId);
     return(View(fileDocument));
 }
Exemple #10
0
 public ActionResult Edit([Bind(Include = "Id,Title,Description,DateStart,DateEnd,IdTrainingCenter,IdTrainingCourse")] ScheduleTtrainingCours schedulettrainingcours)
 {
     if (ModelState.IsValid)
     {
         db.Entry(schedulettrainingcours).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdTrainingCenter = new SelectList(db.TrainingCenters, "Id", "Addres", schedulettrainingcours.IdTrainingCenter);
     ViewBag.IdTrainingCourse = new SelectList(db.TrainingCourses, "Id", "Title", schedulettrainingcours.IdTrainingCourse);
     return(View(schedulettrainingcours));
 }
Exemple #11
0
        public ActionResult Edit([Bind(Include = "Id,Description,Organization,Wages,Additionally,Link")] Vacancy vacancy, string[] selectedQualifications)
        {
            var vacancyToupdate = db.Vacancies.Where(i => i.Id == vacancy.Id).Include(i => i.Qualifications).Single();

            if (ModelState.IsValid)
            {
                UpdateInstructionTags(selectedQualifications, vacancyToupdate);
                db.Entry(vacancyToupdate).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(vacancyToupdate));
        }
Exemple #12
0
        public ActionResult Edit([Bind(Include = "Id,Title,Description,Link,IdTrainingCenter,Parent_Id,Ord_Id")] Menu menu, string NotBindInTrainingCenter)
        {
            if (ModelState.IsValid)
            {
                if (NotBindInTrainingCenter != null && NotBindInTrainingCenter.Equals("on"))
                {
                    menu.NotBindInTrainingCenter = true;
                }

                db.Entry(menu).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(menu));
        }
Exemple #13
0
 public ActionResult Edit([Bind(Include = "Id,Addres,Phone,Email,Organization,Description,Logo,Url,HHCityId")] TrainingCenter trainingcenter, HttpPostedFileBase uploadImage)
 {
     if (ModelState.IsValid)
     {
         if (uploadImage != null)
         {
             byte[] imageData = null;
             // считываем переданный файл в массив байтов
             using (var binaryReader = new BinaryReader(uploadImage.InputStream))
                 imageData = binaryReader.ReadBytes(uploadImage.ContentLength);
             // установка массива байтов
             trainingcenter.Logo            = imageData;
             trainingcenter.LogoContentType = uploadImage.ContentType;
         }
         db.Entry(trainingcenter).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(trainingcenter));
 }
Exemple #14
0
        public async Task <ActionResult> Create([Bind(Include = "UserName,Password,TypeUser,LastName,FirstName,Patronymic,Email,Description,Phone,DateOfBirth,PassportData")] UserMan user)
        {
            user.DateOfBirth = DateTime.Now.ToString();
            if (ModelState.IsValid)
            {
                var tcUrl = RouteData.Values["tc"];
                var tc    = db.TrainingCenters.SingleOrDefault(a => a.Url == tcUrl);

                var anu = new RegisterViewModel();
                anu.UserName        = user.UserName;
                anu.Password        = user.Password;
                anu.ConfirmPassword = user.Password;

                if (user.TypeUser == "teacher")
                {
                    var teacher = new Teacher();
                    teacher.Description = user.Description;
                    teacher.Email       = user.Email;
                    teacher.FirstName   = user.FirstName;
                    teacher.LastName    = user.LastName;
                    teacher.Patronymic  = user.Patronymic;

                    teacher.Phone = user.Phone;

                    db.Teachers.Add(teacher);
                    db.SaveChanges();

                    var teach = db.Teachers.SingleOrDefault(a => a.Email == user.Email);
                    //anu.UserId = teach.Id;

                    TrainingCenterTeacher trainingCenterTeacher = new TrainingCenterTeacher()
                    {
                        IdTeacher = teach.Id, IdTrainingCenter = tc.Id
                    };
                    db.TrainingCenterTeachers.Add(trainingCenterTeacher);
                    db.SaveChanges();
                }
                if (user.TypeUser == "student")
                {
                    var student = new Student();
                    student.Description = user.Description;
                    student.Email       = user.Email;
                    student.FirstName   = user.FirstName;
                    student.LastName    = user.LastName;
                    student.Patronymic  = user.Patronymic;

                    student.DateOfBirth  = Int32.Parse(user.DateOfBirth);
                    student.PassportData = user.PassportData;

                    db.Students.Add(student);
                    db.SaveChanges();

                    var stud = db.Students.SingleOrDefault(a => a.Email == user.Email);
                    //anu.UserId = stud.Id;
                }

                AccountController q = new AccountController();
                await q.Register(anu);

                var savedUser       = db.Users.SingleOrDefault(a => a.Email == user.Email);
                var savedAspNetUser = appDb.Users.SingleOrDefault(a => a.UserName == user.UserName);

                savedUser.AspNetUserId = savedAspNetUser.Id;

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

                return(RedirectToAction("Index"));
            }
            return(View(user));
        }