Пример #1
0
        public Add()
        {
            InitializeComponent();
            var vm = new AddVM();

            DataContext = vm;
        }
Пример #2
0
 public AddWindow(Movie movie)
 {
     InitializeComponent();
     ViewModel   = new AddVM(movie);
     DataContext = ViewModel;
     //apiCalls = new RESTClient();
 }
Пример #3
0
 public AddTask(User loggedUser)
 {
     InitializeComponent();
     taskADB     = new TaskAssistantContext();
     currentUser = loggedUser;
     addVM       = (AddVM)DataContext;
 }
Пример #4
0
        public ActionResult ShowAddForm(string type, AddVM m)
        {
            if (Session["UTYPE"] as string == "ADMIN")
            {
                if (ModelState.IsValid)
                {
                    var db = new userEntities();
                    var currentUserEmail = m.email;

                    var v = db.appointments.Where(u => u.user.Equals(currentUserEmail)).FirstOrDefault();

                    if (v == null)
                    {
                        var hash = Crypto.HashPassword("password");

                        db.users.Add(new user
                        {
                            email     = m.email,
                            firstname = m.firstname,
                            lastname  = m.lastname,
                            password  = hash,
                            dob       = m.dob,
                            utype     = type
                        });
                        db.SaveChanges();

                        if (type == "DOCTOR")
                        {
                            return(RedirectToAction("ManageDoctors", "Admin"));
                        }
                        else if (type == "USER")
                        {
                            return(RedirectToAction("ManagePatients", "Admin"));
                        }
                        else if (type == "ADMIN")
                        {
                            return(RedirectToAction("ManageAdmins", "Admin"));
                        }
                        else
                        {
                            return(RedirectToAction("OpenAdminLanding", "Admin"));
                        }
                    }
                    else
                    {
                        ViewData["Message"] = "User already exists";
                    }
                }
                else
                {
                    return(View());
                }
                return(View());
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Пример #5
0
        public SumVM Add(AddVM addVm)
        {
            var sum = _calculator.Sum(addVm.X, addVm.Y);

            return(new SumVM {
                X = addVm.X, Y = addVm.Y, Sum = sum.ToString()
            });
        }
        public ActionResult Add()
        {
            DepartmentService deptService = new DepartmentService(empDeptDBContext);
            AddVM             addVM       = new AddVM();

            addVM.Departments = deptService.Departments;
            return(View(addVM));
        }
 public ActionResult Add(AddVM vm)
 {
     _deptService = new DepartmentService(_empDeptDBContext);
     _deptService.AddDepartemnt(new Department {
         DName = vm.DName, Location = vm.Location, Description = vm.Description
     });
     return(RedirectToAction("Index", "Department"));
 }
Пример #8
0
        public IActionResult Pong([FromBody] AddVM add)
        {
            if (add != null)
            {
                return(NoContent());
            }

            return(BadRequest());
        }
Пример #9
0
        public ActionResult Add(AddVM vm)
        {
            DepartmentServices deptService = new DepartmentServices(dbContext);

            deptService.AddDepartment(new Department {
                DeptName = vm.DeptName, DeptLoc = vm.DeptLoc
            });
            return(RedirectToAction("Index"));
        }
Пример #10
0
        public SumVM Add(AddVM addVm)
        {
            var z   = _valueProvider.ReadZ();
            var sum = _calculator.Sum(addVm.X, addVm.Y, z.ToString());

            _protokoll.Log(addVm.X, addVm.Y, z, sum);
            return(new SumVM {
                X = addVm.X, Y = addVm.Y, Sum = sum.ToString()
            });
        }
        public ActionResult Add(AddVM vm)
        {
            EmployeeServices   empServices = new EmployeeServices(dbContext);
            DepartmentServices deptService = new DepartmentServices(dbContext);

            empServices.AddEmployee(new Employee {
                EmpName = vm.EmpName, EmpJob = vm.EmpJob, EmpSalary = vm.EmpSalary, Department = deptService.SeacrhDepartment(vm.SelectedDept)
            });
            return(RedirectToAction("Index"));
        }
        public ActionResult Add()
        {
            AddVM              vm          = new AddVM();
            EmployeeServices   empServices = new EmployeeServices(dbContext);
            DepartmentServices deptService = new DepartmentServices();

            vm.DeptLsit = deptService.GetAllDepartment();

            return(View(vm));
        }
Пример #13
0
        public ActionResult Add()
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Login", new { data = "Add" }));
            }
            AddVM addVm = new AddVM();

            addVm.Id = contactService.Contacts.Count + 1;
            return(View(addVm));
        }
        public ActionResult Add(AddVM vm)
        {
            _empService = new EmployeeService(empDeptDBContext);

            Employee employee = new Employee {
                EmpName = vm.EmpName, EmpJob = vm.EmpJob, EmpMGR = vm.EmpMGR, EmpComm = vm.EmpComm, EmpSalary = vm.EmpSalary, EmpHireDate = vm.EmpHireDate
            };

            _empService.AddEmployee(employee, vm.SelectedDepartment);

            return(RedirectToAction("Index", "Employee"));
        }
Пример #15
0
        public ActionResult Add([Bind(Include = "Headline, Text, Author")] AddVM vm, HttpPostedFileBase upload)
        {
            var news = new News {
                Headline = vm.Headline, Text = vm.Text, Author = vm.Author
            };

            if (upload != null && upload.ContentLength > 0)
            {
                using (var reader = new System.IO.BinaryReader(upload.InputStream))
                {
                    news.Picture = reader.ReadBytes(upload.ContentLength);
                }
            }
            db.Add(news);
            return(RedirectToAction(nameof(Index)));
        }
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AddTask"/> class.
        /// </summary>
        /// <param name="loggedUser">User that is logged.</param>
        /// <param name="tasks">Collection of tasks of current user.</param>
        /// <param name="oldtask">Task to change .</param>
        public AddTask(User loggedUser, ObservableCollection <Task> tasks, Task oldtask = null)
        {
            InitializeComponent();
            taskADB     = new TaskAssistantContext();
            currentUser = loggedUser;
            addVM       = (AddVM)DataContext;
            taskList    = tasks;

            if (oldtask != null)
            {
                oldTask          = oldtask;
                addVM.Note       = oldTask.Note;
                addVM.Priority   = oldtask.Priority;
                addVM.CurrHour   = oldtask.Date.Hour;
                addVM.CurrMinute = oldtask.Date.Minute;
                addVM.Date       = oldtask.Date.Date;
            }
        }
Пример #17
0
 public ActionResult Add(AddVM vm)
 {
     TempData.Keep("LoginName");
     if (ModelState.IsValid)
     {
         EntryBL entryBL = new EntryBL();
         Entry   entry   = new Entry();
         entry.Film        = vm.Film;
         entry.Developer   = vm.Developer;
         entry.Dillution   = vm.Dillution;
         entry.Time        = vm.Time;
         entry.ISO         = vm.ISO;
         entry.Temperature = vm.Temperature;
         entry.Notes       = vm.Notes;
         entry.User        = (string)TempData["LoginName"];
         entryBL.AddEntry(entry);
         return(RedirectToAction("Index", "Entry"));
     }
     return(View(vm));
 }
Пример #18
0
        public ActionResult New(int?id)
        {
            //adding the trainings for the user
            List <Employe> employes = new List <Employe>();

            if (id != null)
            {
                employes = db.Employes.Where(e => e.id == id).ToList();
            }
            else
            {
                employes = db.Employes.ToList();
            }
            AddVM model = new AddVM
            {
                employes = employes,
                grades   = db.grades.ToList(),
                results  = db.results.ToList()
            };

            return(View(model));
        }
Пример #19
0
        public ActionResult Create(AddVM model)
        {
            if (ModelState.IsValid)
            {
                db.trainings.Add(model.training);
                db.SaveChanges();
                IndexVM _model = new IndexVM
                {
                    employes  = db.Employes.ToList(),
                    trainings = db.trainings.Include("result")
                                .Include("grade")
                                .Where(t => t.employeId == model.training.employeId).ToList(),
                    employeId = model.training.employeId
                };
                return(View("index", _model));
            }

            else
            {
                model.results = db.results.ToList();
                model.grades  = db.grades.ToList();
                return(View("New", model));
            }
        }
        public ActionResult Add()
        {
            AddVM addVM = new AddVM();

            return(View(addVM));
        }
Пример #21
0
        public ActionResult Add(AddVM addVm)
        {
            contactService.AddContact(addVm.Id, addVm.ContactNo, addVm.FName, addVm.LName, addVm.Email);

            return(RedirectToAction("Home", "Contact"));
        }
Пример #22
0
 public HistoryPage()
 {
     InitializeComponent();
     viewModel      = new AddVM();
     BindingContext = viewModel;
 }
Пример #23
0
 public AddCommand(AddVM addVM)
 {
     viewModel = addVM;
 }
Пример #24
0
 public Add()
 {
     ViewModel = new AddVM();
     InitializeComponent();
 }
Пример #25
0
        public ActionResult Add()
        {
            AddVM vm = new AddVM();

            return(View(vm));
        }