public ActionResult Create(WorkTimeViewModel model) { if (ModelState.IsValid) { //WorkTimeEntity wt=new WorkTimeEntity() //{ // Remarks = model.Remarks, // // StationEntityId = model.StationEntityIds, // // StationEntity = _iStationEntityRepos.FindById(model.StationEntityIds), // //TeamEntityId = _iStationEntityRepos.FindById(model.StationEntityIds).TeamEntityId, // WtContent=model.WtContent, // WtStartDateTime = model.WtStartDateTime, // WtOverDateTime = model.WtOverDateTime, // WtValue = model.WtValue // }; var wt = EntityMapper.GetEntity <WorkTimeEntity, WorkTimeViewModel>(model); wt.StationEntities = _iStationEntityRepos.FindById(model.StationEntityIds); _workTimeRepos.add(wt); //db.WorkTimeEntities.Add(workTimeEntity); int i = _workTimeRepos.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }
protected override DwNumber DataReaderToEntity(MySqlDataReader dr, MetaDataTable metaDataTable, params string[] columnNames) { if (dr == null) { throw new ArgumentNullException("dr", "未将对象引用到实例"); } return(EntityMapper.GetEntity <DwNumber>(dr, new DwNumber(), this._tableName)); }
private NumberIdSeq DataReaderToNumberIdSeq(MySqlDataReader dr, MetaDataTable metaDataTable, params string[] columnNames) { if (dr == null) { throw new ArgumentNullException("dr", "未将对象引用到实例"); } return(EntityMapper.GetEntity <NumberIdSeq>(dr, new NumberIdSeq(), this._tableName)); }
private DimensionNumberType DataReaderToNumberTypeDim(SqlDataReader dr, MetaDataTable metaDataTable, params string[] columnNames) { if (dr == null) { throw new ArgumentNullException("dr", "未将对象引用到实例"); } return(EntityMapper.GetEntity <DimensionNumberType>(dr, new DimensionNumberType(), this._tableName)); }
/// <summary> /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// </summary> /// <param name="dr">有效的DataReader对象</param> /// <param name="columnNames">该数据传输对象中对应的数据库表的字段(列)名</param> /// <returns>数据传输对象实例</returns> protected override OmissionValue DataReaderToEntity(MySqlDataReader dr, MetaDataTable metaDataTable, params string[] columnNames) { if (dr == null) { throw new ArgumentNullException("dr", "未将对象引用到实例"); } return(EntityMapper.GetEntity(dr, new OmissionValue(), OmissionValue.ENTITYNAME)); }
protected override CategoryDTO DataReaderToEntity(MySqlDataReader dr, MetaDataTable metaDataTable, params string[] columnNames) { if (dr == null) { throw new ArgumentNullException("dr", "未将对象引用到实例"); } return(EntityMapper.GetEntity(dr, new CategoryDTO(), metaDataTable)); }
/// <summary> /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// </summary> /// <param name="dr">有效的DataReader对象</param> /// <param name="columnNames">该数据传输对象中对应的数据库表的字段(列)名</param> /// <returns>数据传输对象实例</returns> protected override DimensionNumberType DataReaderToEntity(SqlDataReader dr, MetaDataTable metaDataTable, params string[] columnNames) { if (dr == null) { throw new ArgumentNullException("dr", "未将对象引用到实例"); } return(EntityMapper.GetEntity(dr, new DimensionNumberType(), DimensionNumberType.ENTITYNAME)); }
// GET: WorkTimeEntities/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkTimeEntity workTimeEntity = db.WorkTimeEntities.Find(id); if (workTimeEntity == null) { return(HttpNotFound()); } WorkTimeViewModel model = EntityMapper.GetEntity <WorkTimeViewModel, WorkTimeEntity>(workTimeEntity); model.SelectStationid = GetSelectListItems(); return(View(model)); }
// GET: StationEntities/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StationEntity stationEntity = _iStationEntityRepos.FindById(id); if (stationEntity == null) { return(HttpNotFound()); } // var result = EntityMapper.GetStationViewModelByEntity(stationEntity); var result = EntityMapper.GetEntity <StationViewModel, StationEntity>(stationEntity); result.TeamEntityId = stationEntity.TeamEntities.TeamEntityId; GetTeamValueAndSetViewBag(); return(View(result)); }