MCVef/Controllers/DoctorsController.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
using MCVef.Models;
namespace MCVef.Controllers
{
public class DoctorsController : ApiController
{
private HospitalModel db = new HospitalModel();
public string Options()
{
return null;
}
// GET: api/Doctors
public IQueryable<Doctor> GetDoctor()
{
return db.Doctor;
}
// GET: api/Doctors/?
/// <summary>
/// 医生条件查询
/// </summary>
[ResponseType(typeof(Doctor))]
public IHttpActionResult GetDoctor(int? doctorId, string doctorName, string doctorDepartment)
{
IQueryable<Doctor> doctors = db.Doctor;
if(doctorId != null)
{
doctors = doctors.Where(d => d.DoctorId == doctorId);
}
if (!string.IsNullOrEmpty(doctorName))
{
doctors = doctors.Where(d => d.DoctorName.Equals(doctorName));
}
if(!string.IsNullOrEmpty(doctorDepartment))
{
doctors = doctors.Where(d => d.DoctorDepartment.Equals(doctorDepartment));
}
if (doctors == null || doctors.Count() == 0)
{
return NotFound();
}
return Ok(doctors);
}
// PUT: api/Doctors/5
[ResponseType(typeof(void))]
public IHttpActionResult PutDoctor(int id, Doctor doctor)
后面还有 78 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。