public async Task <IHttpActionResult> PutHistoryPoint(int id, HistoryPoint historyPoint) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != historyPoint.Id) { return(BadRequest()); } db.Entry(historyPoint).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HistoryPointExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetHistoryPoint(int id) { HistoryPoint historyPoint = await db.HistoryPoints.FindAsync(id); if (historyPoint == null) { return(NotFound()); } return(Ok(historyPoint)); }
public IHttpActionResult PostHistoryPoint(HistoryPointDTO historyPointDTO) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } HistoryPoint historyPoint = AutoMapperConfig.AppMapper.Map <HistoryPointDTO, HistoryPoint>(historyPointDTO); db.HistoryPoints.Add(historyPoint); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = historyPoint.Id }, historyPoint)); }
public async Task <IHttpActionResult> DeleteHistoryPoint(int id) { HistoryPoint historyPoint = await db.HistoryPoints.FindAsync(id); if (historyPoint == null) { return(NotFound()); } db.HistoryPoints.Remove(historyPoint); await db.SaveChangesAsync(); return(Ok(historyPoint)); }
public ActionResult Create(HistoryPointViewModel model) { if (ModelState.IsValid) { var HistoryPoint = new HistoryPoint(); AutoMapper.Mapper.Map(model, HistoryPoint); SetModifier(HistoryPoint); HistoryPointService.Create(HistoryPoint); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; if (Request["IsPopup"] != null && Request["IsPopup"].ToString().ToLower().Equals("true")) { return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" })); } return(RedirectToAction("Index")); } return(View(model)); }
public static void CreatePoint(int?CustomerId, int?TargetId, string TargetName, double?AccumulatedPoint, double?UsePoint) { IHistoryPointService HistoryPointService = DependencyResolver.Current.GetService <IHistoryPointService>(); var HistoryPoint = new HistoryPoint(); HistoryPoint.IsDeleted = false; HistoryPoint.CreatedUserId = WebSecurity.CurrentUserId; HistoryPoint.CreatedDate = DateTime.Now; HistoryPoint.ModifiedUserId = WebSecurity.CurrentUserId; HistoryPoint.ModifiedDate = DateTime.Now; HistoryPoint.CustomerId = CustomerId; HistoryPoint.TargetId = TargetId; HistoryPoint.TargetName = TargetName; HistoryPoint.AccumulatedPoint = AccumulatedPoint; HistoryPoint.UsePoint = UsePoint; HistoryPointService.Create(HistoryPoint); }
/// <summary> /// 移除最开始那个航迹点 /// </summary> /// <returns></returns> public ElementInfo RemoveTrackPoint() { return(HistoryPoint.Dequeue()); }
/// <summary> /// 添加航迹点 /// </summary> /// <param name="elementInfo"></param> /// <returns></returns> public bool AddTrackPoint(ElementInfo elementInfo) { HistoryPoint.Enqueue(elementInfo); return(true); }
public void ImportAreaModel(bool convertModel, bool convertCollision, string inputKey) { var res = PublicFunctions.GetModelViaModelConverter(loadVisualMapAsDefault: convertModel, loadCollisionAsDefault: convertCollision, inputsKey: inputKey); if (res is object) { Ogl.MakeCurrent(); Main.SuspendLayout(); { var withBlock = Main.CArea; HistoryPoint hp = null; var OldAreaModel = withBlock.AreaModel; if (res.Value.hasCollision && res.Value.hasVisualMap == true) { hp = HistoryPoint.FromObject(this, ObjectValueType.Field, new MemberWhiteList(new[] { "rndrVisualMap", "cVisualMap", "rndrCollisionMap", "cCollisionMap" }), BindingFlags.Instance | BindingFlags.NonPublic); var os = new ObjectState(); os.Object = Main.CArea; os.ValueToPatch = withBlock.AreaModel; os.MemberFlags = BindingFlags.Instance | BindingFlags.Public; os.MemberType = ObjectValueType.Property; os.MemberName = "AreaModel"; hp.Entries.Add(os); withBlock.AreaModel = res?.mdl; withBlock.AreaModel.Collision.SpecialBoxes = OldAreaModel.Collision.SpecialBoxes; cVisualMap = null; cCollisionMap = null; } else if (res.Value.hasCollision == true) { hp = HistoryPoint.FromObject(this, ObjectValueType.Field, new MemberWhiteList(new[] { "rndrCollisionMap", "cCollisionMap" }), BindingFlags.Instance | BindingFlags.NonPublic); var os = new ObjectState(); os.Object = Main.CArea.AreaModel; os.ValueToPatch = withBlock.AreaModel.Collision; os.MemberFlags = BindingFlags.Instance | BindingFlags.Public; os.MemberType = ObjectValueType.Property; os.MemberName = "Collision"; hp.Entries.Add(os); withBlock.AreaModel.Collision = res?.mdl.Collision; withBlock.AreaModel.Collision.SpecialBoxes = OldAreaModel.Collision.SpecialBoxes; cCollisionMap = null; } else if (res.Value.hasVisualMap == true) { hp = HistoryPoint.FromObject(this, ObjectValueType.Field, new MemberWhiteList(new[] { "rndrVisualMap", "cVisualMap" }), BindingFlags.Instance | BindingFlags.NonPublic); var os = new ObjectState(); os.Object = Main.CArea.AreaModel; os.ValueToPatch = withBlock.AreaModel.Fast3DBuffer; os.MemberFlags = BindingFlags.Instance | BindingFlags.Public; os.MemberType = ObjectValueType.Property; os.MemberName = "Fast3DBuffer"; hp.Entries.Add(os); withBlock.AreaModel = res?.mdl; withBlock.AreaModel.Collision = OldAreaModel.Collision; cVisualMap = null; } if (res.Value.hasVisualMap == true) { withBlock.ScrollingTextures.Clear(); withBlock.ScrollingTextures.AddRange(withBlock.AreaModel.Fast3DBuffer.ConvertResult.ScrollingCommands.ToArray()); Main.Rommgr.RomConfig.GetLevelConfig(Main.CLevel.LevelID).GetLevelAreaConfig(withBlock.AreaID).ScrollingNames = res?.mdl.Fast3DBuffer.ConvertResult.ScrollingNames; } if (hp != null && hp.Entries.Any()) { Main.history.Store(hp); } } Main.CArea.SetSegmentedBanks(Main.Rommgr); LoadAreaModel(); Main.ResumeLayout(); } else { Ogl.MakeCurrent(); } }