public async Task <IActionResult> Edit(Guid id, [Bind("Id,Description,timeStamp")] MedicineLog medicineLog)
        {
            if (id != medicineLog.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(medicineLog);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MedicineLogExists(medicineLog.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(medicineLog));
        }
 public async Task <IActionResult> Create([Bind("Id,Description,timeStamp")] MedicineLog medicineLog)
 {
     if (ModelState.IsValid)
     {
         medicineLog.Id = Guid.NewGuid();
         _medService.Insert(medicineLog);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(medicineLog));
 }
        public async Task <IActionResult> Create([Bind("Id,Description,timeStamp")] MedicineLog medicineLog)
        {
            if (ModelState.IsValid)
            {
                medicineLog.Id = Guid.NewGuid();
                _context.Add(medicineLog);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(medicineLog));
        }
 public void Insert(MedicineLog obj)
 {
     data.Add(obj);
     context.SaveChanges();
 }
Example #5
0
 public void Insert(MedicineLog obj)
 {
     _medLog.Insert(obj);
 }