public async Task <IActionResult> PutCustomers(int id, Customers customers)
        {
            if (id != customers.Id)
            {
                return(BadRequest());
            }

            _context.Entry(customers).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomersExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Code,Details")] Durations durations)
        {
            if (ModelState.IsValid)
            {
                _context.Add(durations);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(durations));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Cities cities)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cities);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cities));
        }
        public async Task <IActionResult> Create([Bind("Id,Totalamount,Categoryname")] CustomerCategories customerCategories)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customerCategories);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customerCategories));
        }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("Id,Timestamp,Text")] Logs logs)
        {
            if (ModelState.IsValid)
            {
                _context.Add(logs);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(logs));
        }
Esempio n. 6
0
        public async Task <IActionResult> Create([Bind("Id,Lastname,Firstname,Address,CityId,Phone,Email,Mobile")] Customers customers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.Cities, "Id", "Name", customers.CityId);
            return(View(customers));
        }
Esempio n. 7
0
        public async Task <IActionResult> Create([Bind("Id,Itemnb,Brand,Model,Size,CategoryId,Cost,Returned,Type,Stock,Serialnumber")] Items items)
        {
            if (ModelState.IsValid)
            {
                _context.Add(items);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Code", items.CategoryId);
            return(View(items));
        }
Esempio n. 8
0
        public async Task <IActionResult> Create([Bind("Id,CustomerId,Date,Description,Amount")] Purchases purchases)
        {
            if (ModelState.IsValid)
            {
                _context.Add(purchases);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "Id", "Firstname", purchases.CustomerId);
            return(View(purchases));
        }
Esempio n. 9
0
        public async Task <IActionResult> Create([Bind("Id,CategoryId,DurationId,GeartypeId,Price")] Rentprices rentprices)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rentprices);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Code", rentprices.CategoryId);
            ViewData["DurationId"] = new SelectList(_context.Durations, "Id", "Code", rentprices.DurationId);
            ViewData["GeartypeId"] = new SelectList(_context.Geartypes, "Id", "Name", rentprices.GeartypeId);
            return(View(rentprices));
        }
Esempio n. 10
0
        public async Task <IActionResult> Create([Bind("Id,Creationdate,Effectivereturn,Plannedreturn,CustomerId,Notes,Total,Takenon,Paidon,Insurance,Goget,HelpStaffId,TuneStaffId")] Contracts contracts)
        {
            if (ModelState.IsValid)
            {
                _context.Add(contracts);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"]  = new SelectList(_context.Customers, "Id", "Firstname", contracts.CustomerId);
            ViewData["HelpStaffId"] = new SelectList(_context.Staffs, "Id", "Id", contracts.HelpStaffId);
            ViewData["TuneStaffId"] = new SelectList(_context.Staffs, "Id", "Id", contracts.TuneStaffId);
            return(View(contracts));
        }
Esempio n. 11
0
        public async Task <IActionResult> Create([Bind("Id,ItemId,ContractId,DurationId,CategoryId,Price,Description,Linenb,Partialreturn")] Renteditems renteditems)
        {
            if (ModelState.IsValid)
            {
                _context.Add(renteditems);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Code", renteditems.CategoryId);
            ViewData["ContractId"] = new SelectList(_context.Contracts, "Id", "Id", renteditems.ContractId);
            ViewData["DurationId"] = new SelectList(_context.Durations, "Id", "Code", renteditems.DurationId);
            ViewData["ItemId"]     = new SelectList(_context.Items, "Id", "Itemnb", renteditems.ItemId);
            return(View(renteditems));
        }