Esempio n. 1
0
        public async Task <Residents> PostResidents(Residents item)
        {
            Residents resident = null;

            if (item == null)
            {
                throw new NullReferenceException();
            }
            else
            {
                resident = new Residents()
                {
                    ResidentName     = item.ResidentName,
                    ResidentEmail    = item.ResidentEmail,
                    ResidentHouseNo  = item.ResidentHouseNo,
                    ResidentMobileNo = item.ResidentMobileNo,
                    ResidentPassword = item.ResidentPassword,
                    ResidentType     = item.ResidentType,
                    ResidentWallet   = 0,
                    IsApproved       = "notApproved"
                };
                await _context.Residents.AddAsync(resident);

                await _context.SaveChangesAsync();
            }
            return(resident);
        }
Esempio n. 2
0
        public async Task <Employees> PostEmployees(Employees item)
        {
            Employees employee = null;

            if (item == null)
            {
                throw new NullReferenceException();
            }
            else
            {
                employee = new Employees()
                {
                    EmployeeName = item.EmployeeName, EmployeeEmail = item.EmployeeEmail, EmployeeDept = item.EmployeeDept, EmployeeMobile = item.EmployeeMobile, EmployeePassword = item.EmployeePassword, EmployeeRating = item.EmployeeRating, EmployeeWallet = item.EmployeeWallet, IsApproved = item.IsApproved
                };
                await _context.Employees.AddAsync(employee);

                await _context.SaveChangesAsync();
            }
            return(employee);
        }
Esempio n. 3
0
        public async Task <HouseList> PostHouse(HouseList item)
        {
            HouseList house = null;

            if (item == null)
            {
                throw new NullReferenceException();
            }
            else
            {
                house = new HouseList()
                {
                    HouseId = item.HouseId,
                    IsFree  = item.IsFree
                };
                await _context.HouseList.AddAsync(house);

                await _context.SaveChangesAsync();
            }
            return(house);
        }