Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Row,DoctorID,Name,Family,Image,OfficeImage,BirthDate,MyProperty,Desc")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(doctor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctor));
        }
Esempio n. 2
0
        public async Task <string> CreateDoctor([FromBody] List <Doctor> doctors)
        {
            if (ModelState.IsValid)
            {
                Doctor doctor1 = new Doctor();
                doctor1.Row         = doctors[0].Row;
                doctor1.DoctorID    = doctors[0].DoctorID;
                doctor1.Name        = doctors[0].Name;
                doctor1.Family      = doctors[0].Family;
                doctor1.Image       = doctors[0].Image;
                doctor1.OfficeImage = doctors[0].OfficeImage;
                doctor1.BirthDate   = doctors[0].BirthDate;
                doctor1.MyProperty  = doctors[0].MyProperty;
                _context.doctors.Add(doctor1);
                await _context.SaveChangesAsync();

                return("عملیات با موفقیت انجام شد");
            }
            return("عملیات ناموفق");
        }