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);
 }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
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("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));
        }
        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));
        }