Esempio n. 1
0
        public async Task <IActionResult> PutSpecialization([FromRoute] int id, [FromBody] Specialization specialization)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != specialization.SpecID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutDoctors([FromRoute] int id, [FromBody] Doctors doctors)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != doctors.DoctorID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutMedical_Enterprise([FromRoute] int id, [FromBody] Medical_Enterprise medical_Enterprise)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != medical_Enterprise.MedID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
 public async Task<IActionResult> Create([Bind("MedicineID,Name,Description,Quantity,MedicineCode,Img,Use_in_case,Contradication,Price")] Medicine medicine)
 {
     if (ModelState.IsValid)
     {
         _context.Add(medicine);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     return View(medicine);
 }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("SpecID,SpecName,SpecDescription")] Specialization specialization)
        {
            if (ModelState.IsValid)
            {
                _context.Add(specialization);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(specialization));
        }
        public async Task <IActionResult> Create([Bind("MedID,MedName,MedDescription,MedAddress,Time_at")] Medical_Enterprise medical_Enterprise)
        {
            if (ModelState.IsValid)
            {
                _context.Add(medical_Enterprise);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(medical_Enterprise));
        }
Esempio n. 7
0
        public async Task <IActionResult> Create([Bind("PharmID,PharmName,PharmAddress,PharmPhone,Time_at")] Pharmacy pharmacy)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pharmacy);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pharmacy));
        }
        public async Task <IActionResult> Create([Bind("DoctorID,DoctorName,DoctorSurname,DoctorDescription,DoctorPhone,Price,doctorType,DoctorEnterprise")] Doctors doctors)
        {
            var id  = Int32.Parse(Request.Form["doctorType"]);
            var id2 = Int32.Parse(Request.Form["DoctorEnterprise"]);
            //System.Diagnostics.Debug.WriteLine("ID1: "+id+" ID2: "+id2);
            var specialization = await _context.Specialization.FindAsync(id);

            var med = await _context.Medical_Enterprise.FindAsync(id2);

            doctors.doctorType       = specialization;
            doctors.DoctorEnterprise = med;

            if (ModelState.IsValid)
            {
                _context.Add(doctors);
                await _context.SaveChangesAsync();

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