예제 #1
0
 public void Delete(Family entity)
 {
     entity.ModificationDate = DateTime.Today;
     entity.State            = State.Removed;
     _context.Update(entity);
     Save();
 }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ProfessorID,Name,Email,PhoneNumber")] Professor professor)
        {
            if (id != professor.ProfessorID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(professor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfessorExists(professor.ProfessorID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(professor));
        }
예제 #3
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Title,Description")] Category category)
        {
            if (id != category.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(category);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoryExists(category.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
예제 #4
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,PersonId,CategoryId,HeroUrl,Title,Description,Deadline,Goal")] Project project)
        {
            if (id != project.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(project);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Title", project.CategoryId);
            ViewData["PersonId"]   = new SelectList(_context.AspNetUsers, "Id", "Id", project.PersonId);
            return(View(project));
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("CSSystemID,Name,IPAddress,PrimaryUserID")] CSSystem cSSystem)
        {
            if (id != cSSystem.CSSystemID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cSSystem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CSSystemExists(cSSystem.CSSystemID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PrimaryUserID"] = new SelectList(_context.Professors, "ProfessorID", "ProfessorID", cSSystem.PrimaryUserID);
            return(View(cSSystem));
        }
예제 #6
0
        public async Task <IActionResult> Edit(string id, [Bind("Major,ID,FirstName,LastName,Email,Phone")] Member member)
        {
            if (id != member.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(member);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MemberExists(member.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(member));
        }
        public async Task <IActionResult> Edit(int id, [Bind("UsersId,Company_Name,Purchased_Amount, Amount_Paid")] StockPurchaseEntry stockPurchaseEntry)
        {
            if (id != stockPurchaseEntry.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(stockPurchaseEntry);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StockPurchaseEntryExists(stockPurchaseEntry.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UsersId"] = new SelectList(_context.Users, "Id", "Id", stockPurchaseEntry.UsersId);
            return(View(stockPurchaseEntry));
        }
예제 #8
0
        public async Task <IActionResult> Edit(int id, [Bind("SoftwareID,Name,Version,URL,CSOnly")] Software software)
        {
            if (id != software.SoftwareID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(software);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SoftwareExists(software.SoftwareID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(software));
        }
예제 #9
0
        public async Task <IActionResult> Edit(string id, [Bind("CompanyName,ID,FirstName,LastName,Email,Phone")] Client client)
        {
            if (id != client.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(client);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientExists(client.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
예제 #10
0
        public async Task <IActionResult> Edit(int id, [Bind("Username,Pword,Amount")] Users users)
        {
            if (id != users.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
예제 #11
0
        public async Task <IActionResult> Edit(string id, [Bind("ID,ProjectName,ProjectDescription")] Project project)
        {
            if (id != project.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(project);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(project));
        }
예제 #12
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,PersonId,CategoryId,HeroUrl,Title,Description,Deadline,Goal,Progress")] Project project)
        {
            if (id != project.Id)
            {
                return(NotFound());
            }

            var dbproject = await _context.Project.SingleOrDefaultAsync(p => p.Id == id);

            dbproject.Category    = project.Category;
            dbproject.HeroUrl     = project.HeroUrl;
            dbproject.Title       = project.Title;
            dbproject.Description = project.Description;
            dbproject.Deadline    = project.Deadline;
            dbproject.Goal        = project.Goal;

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dbproject);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", new { id = project.Id }));
                //return RedirectToAction("~/Views/ProjectsAll/Index.cshtml", new { id = project.Id });
                //return View("~/Views/ProjectsAll/Index.cshtml", await finalProjectContext.ToListAsync());
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Title", dbproject.CategoryId);
            string useridd = HttpContext.User.Identity.Name;

            var userid = from m in _context.AspNetUsers
                         where m.Email == useridd
                         select m.Id;

            ViewData["PersonId"] = new SelectList(userid);
            //ViewData["PersonId"] = new SelectList(_context.AspNetUsers, "Id", "Id", project.PersonId);
            return(View(dbproject));
        }
예제 #13
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,ProjectId,Name,Description,Value")] Package package)
        {
            if (id != package.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(package);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PackageExists(package.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", new { id = package.ProjectId }));
            }
            string useridd = HttpContext.User.Identity.Name;
            var    userid  = (from m in _context.AspNetUsers
                              where m.Email == useridd
                              select m.Id)
                             .FirstOrDefault();

            var prjcts = (from m in _context.Project
                          join sem in _context.Package on m.Id equals sem.ProjectId
                          where m.PersonId == userid
                          select new { m.Title, sem.ProjectId, m.Id }).Distinct();

            //ViewData["ProjectId"] = new SelectList(prjcts);
            ViewData["ProjectId"] = new SelectList(prjcts, "Id", "Title", package.ProjectId);
            //ViewData["ProjectId"] = new SelectList(_context.Project, "Id", "Title", package.ProjectId);
            return(View());
            //ViewData["ProjectId"] = new SelectList(_context.Project, "Id", "Title", package.ProjectId);
            //return View(package);
        }
        public async Task <IActionResult> Edit(int id, [Bind("InventoryItemID,Description,UserID")] InventoryItem inventoryItem)
        {
            if (id != inventoryItem.InventoryItemID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    //Automatically marking item checked out status based on if there was a UserID passed or not
                    if (inventoryItem.UserID != null)
                    {
                        inventoryItem.CheckedOut = true;
                    }
                    else
                    {
                        inventoryItem.CheckedOut = false;
                    }
                    _context.Update(inventoryItem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InventoryItemExists(inventoryItem.InventoryItemID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserID"] = new SelectList(_context.Professors, "ProfessorID", "ProfessorID", inventoryItem.UserID);
            return(View(inventoryItem));
        }
예제 #15
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,PersonId,CategoryId,HeroUrl,Title,Description,Deadline,Goal")] Project project)
        {
            if (id != project.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(project);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(Redirect("https://localhost:44361"));
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Title", project.CategoryId);
            string useridd = HttpContext.User.Identity.Name;

            var userid = from m in _context.AspNetUsers
                         where m.Email == useridd
                         select m.Id;

            ViewData["PersonId"] = new SelectList(userid);
            //ViewData["PersonId"] = new SelectList(_context.AspNetUsers, "Id", "Id", project.PersonId);
            return(View(project));
        }
예제 #16
0
 public async void Update(Movie entity)
 {
     _context.Update(entity);
     await _context.SaveChangesAsync();
 }