public ActionResult DeleteConfirmed(int id)
        {
            Appoitment appoitment = db.Appoitment.Find(id);

            db.Appoitment.Remove(appoitment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "appoitmentID,appoitmentDescription,appoitmentPrice,carId,ownerID")] Appoitment appoitment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(appoitment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.carId   = new SelectList(db.Car, "carId", "make", appoitment.carId);
     ViewBag.ownerID = new SelectList(db.Owner, "ownerID", "firstName", appoitment.ownerID);
     return(View(appoitment));
 }
        // GET: Appointments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Appoitment appoitment = db.Appoitment.Find(id);

            if (appoitment == null)
            {
                return(HttpNotFound());
            }
            return(View(appoitment));
        }
Esempio n. 4
0
        public async Task <AppoitmentResponse> SaveAsync(Appoitment appoitment)
        {
            try
            {
                await _appoitmentRepository.AddAsync(appoitment);

                await _unitOfWork.CompleteAsync();

                return(new AppoitmentResponse(appoitment));
            }
            catch (Exception ex)
            {
                return(new AppoitmentResponse($"An error ocurred while saving the tag: {ex.Message}"));
            }
        }
        // GET: Appointments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Appoitment appoitment = db.Appoitment.Find(id);

            if (appoitment == null)
            {
                return(HttpNotFound());
            }
            ViewBag.carId   = new SelectList(db.Car, "carId", "make", appoitment.carId);
            ViewBag.ownerID = new SelectList(db.Owner, "ownerID", "firstName", appoitment.ownerID);
            return(View(appoitment));
        }
Esempio n. 6
0
        public async Task <AppoitmentResponse> UpdateAsync(int id, Appoitment appoitment)
        {
            var existingTag = await _appoitmentRepository.FindByIDAsync(id);

            if (existingTag == null)
            {
                return(new AppoitmentResponse("Appoitment not found"));
            }

            existingTag.Date = appoitment.Date;

            try
            {
                _appoitmentRepository.Update(existingTag);
                await _unitOfWork.CompleteAsync();

                return(new AppoitmentResponse(existingTag));
            }
            catch (Exception ex)
            {
                return(new AppoitmentResponse($"An error ocurred while updating tag: {ex.Message}"));
            }
        }
Esempio n. 7
0
 public void Update(Appoitment appoitment)
 {
     _context.Appoitments.Update(appoitment);
 }
Esempio n. 8
0
 public void Remove(Appoitment appoitment)
 {
     _context.Appoitments.Remove(appoitment);
 }
Esempio n. 9
0
 public async Task AddAsync(Appoitment appoitment)
 {
     await _context.Appoitments.AddAsync(appoitment);
 }