Пример #1
0
        public ActionResult Create([Bind(Include = "EmployeeId,FirstName,LastName,Email,PhoneNumber,JobTitle,DateOfBirth,Password")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
Пример #2
0
        public ActionResult Create([Bind(Include = "TenantId,FirstName,LastName,Address,Email,PhoneNumber,MaritalStatus,Password,DateOfBirth")] Tenant tenant)
        {
            if (ModelState.IsValid)
            {
                db.Tenants.Add(tenant);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tenant));
        }
        public ActionResult Create([Bind(Include = "BuildingId,Address,PostalCode,City,Province,YearBuilt,EmployeeId")] Building building)
        {
            if (ModelState.IsValid)
            {
                db.Buildings.Add(building);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "EmployeeId", "FirstName", building.EmployeeId);
            return(View(building));
        }
        public ActionResult Create([Bind(Include = "AppointmentId,AppointmentDate,AppointmentTime,EmployeeId,TenantId,Description")] Appointment appointment)
        {
            if (ModelState.IsValid)
            {
                db.Appointments.Add(appointment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "EmployeeId", "FirstName", appointment.EmployeeId);
            ViewBag.TenantId   = new SelectList(db.Tenants, "TenantId", "FirstName", appointment.TenantId);
            return(View(appointment));
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "ApartmentId,BuildingId,ApartmentNumber,Rooms,Price,Status,Description,TenantId")] Apartment apartment)
        {
            if (ModelState.IsValid)
            {
                db.Apartments.Add(apartment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.BuildingId = new SelectList(db.Buildings, "BuildingId", "Address", apartment.BuildingId);
            ViewBag.TenantId   = new SelectList(db.Tenants, "TenantId", "FirstName", apartment.TenantId);
            return(View(apartment));
        }
Пример #6
0
        public ActionResult Create([Bind(Include = "MessageId,MessageTitle,MessageDate,Description,TenantId,EmployeeId")] Message message)
        {
            if (ModelState.IsValid)
            {
                db.Messages.Add(message);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "EmployeeId", "FirstName", message.EmployeeId);
            ViewBag.TenantId   = new SelectList(db.Tenants, "TenantId", "FirstName", message.TenantId);
            return(View(message));
        }
Пример #7
0
 public ActionResult TenantSignup(Tenant tenant)
 {
     using (BuildingManagementDBEntities context = new
                                                   BuildingManagementDBEntities())
     {
         context.Tenants.Add(tenant);
         context.SaveChanges();
     }
     return(RedirectToAction("Login"));
 }
Пример #8
0
 public ActionResult employeeSignup(Employee emp)
 {
     using (BuildingManagementDBEntities context = new
                                                   BuildingManagementDBEntities())
     {
         context.Employees.Add(emp);
         context.SaveChanges();
     }
     return(RedirectToAction("Login"));
 }