public async Task <IActionResult> Edit(int id, [Bind("ID,ProjectName,Description,Freelancer,Rating,DeliveredOn")] MyHistory myHistory)
        {
            if (id != myHistory.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(myHistory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MyHistoryExists(myHistory.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(myHistory));
        }
Example #2
0
        async void GetAllDoses()
        {
            MyHistory.Clear();
            List <Dose> doses = await MyDoseDatabase.GetItemsAsync();

            doses.ToList().ForEach(MyHistory.Add);
        }
        public async Task <IActionResult> Create([Bind("ID,ProjectName,Description,Freelancer,Rating,DeliveredOn")] MyHistory myHistory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(myHistory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(myHistory));
        }