Beispiel #1
0
        public InfoFrame(formular formular, student student)//nu clean code da e important
        {
            InitializeComponent();
            this.formular = formular;
            this.student  = student;

            this.DataContext             = this;
            CourseDescription.Visibility = Visibility.Visible;
            AuthorName.Visibility        = Visibility.Visible;
        }
Beispiel #2
0
 public void UpdateFormular(formular formular)
 {
     using (RoomsContext context = new RoomsContext())
     {
         formular updateFormular = context.Formular.Where(x => x.id == formular.id).ToList().FirstOrDefault();
         updateFormular.cameraID      = formular.studentID;
         updateFormular.caminID       = formular.caminID;
         updateFormular.cameraID      = formular.cameraID;
         updateFormular.StareFormular = formular.StareFormular;
         context.SaveChanges();
     }
 }
        public ActionResult Create(BookAuthorViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string Filename = string.Empty;
                    if (model.File != null)
                    {
                        string upload = Path.Combine(hosting.ContentRootPath, "uploads");
                        Filename = model.File.FileName;
                        string fullpath = Path.Combine(upload, Filename);
                        model.File.CopyTo(new FileStream(fullpath, FileMode.Create));
                    }
                    if (model.AuthorId == -1)
                    {
                        ViewBag.Message = "Bitte Checken Sie Ihr Eingabe nach";

                        return(View(GetAllAuthors()));
                    }
                    formular book = new formular
                    {
                        ID          = model.BookId,
                        Title       = model.Title,
                        Description = model.Description,
                        Author      = authorrepository.Find(model.AuthorId),
                        ImageUrl    = Filename
                    };
                    bookrepository.Add(book);
                    return(RedirectToAction(nameof(Index)));
                }
                catch
                {
                    return(View());
                }
            }

            else
            {
                ModelState.AddModelError("", "Bitte prüfen Sie Ihr Eingabe nach !");
                return(View(GetAllAuthors()));
            }
        }
        public ActionResult Edit(int id, BookAuthorViewModel model)
        {
            try
            {
                formular book = new formular
                {
                    Title       = model.Title,
                    Description = model.Description,
                    Author      = authorrepository.Find(model.AuthorId),
                };
                bookrepository.Update(model.BookId, book);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #5
0
 public Cards(formular course)
 {
 }