//[Ignore] public void GetText_Returns_UpdateText() { var person = new Person(); var mapping = new PersonMap(); mapping.ExecuteMapping(); var mapInt = new TypeMap(DbType.Int32, typeof(int), new GenericConverter()); var mapString = new TypeMap(DbType.String, typeof(string), new GenericConverter()); var mock = new Moq.Mock <ITypeRegister>(); mock.Setup(x => x.Get(typeof(int))).Returns(mapInt); mock.Setup(x => x.Get(typeof(string))).Returns(mapString); var dbparam = new Moq.Mock <IDbDataParameter>(); Func <IDbDataParameter> func = () => dbparam.Object; var register = mock.Object; var insert = new UpdatePlan(mapping, register); var text = insert.CreatePlanParameter(func, person); text.SqlText.ToUpper().Should().Be("UPDATE PERSON SET NAME = @NAME, AGE = @AGE WHERE ID = @ID"); text.Parameters.Count.Should().Be(3); }
public async Task <ApiResult <GetProcessPlanById> > Update(UpdatePlan bundle) { var json = JsonConvert.SerializeObject(bundle); var httpContent = new StringContent(json, Encoding.UTF8, "application/json"); var url = $"/api/ProcessPlan/"; var result = await Update <GetProcessPlanById>(url, httpContent); return(result); }
public async Task <IActionResult> Update([FromBody] UpdatePlan bundle) { var resultId = await _processPlanService.Update(bundle); if (resultId.IsSuccessed) { var result = await _processPlanService.GetProcessPlanById(resultId.ResultObj); return(Ok(result)); } return(BadRequest(resultId)); }
public async Task <ApiResult <long> > Update(UpdatePlan bundle) { var order = await _context.ProcessPlans.FindAsync(bundle.Id); order.Name = bundle.Name; order.Note = bundle.Note; order.IdResponsible = bundle.IdResponsible; order.ExpectedDate = bundle.ExpectedDate; _context.ProcessPlans.Update(order); await _context.SaveChangesAsync(); return(new ApiSuccessResult <long>(order.Id)); }
public ICommandResult Handle(UpdatePlanInput input) { var plan = _planRepository.GetById(input.Id); plan.Update(input.Name, input.ValueCents); var validator = new PlanValidator().Validate(plan); if (validator.IsValid) { _planRepository.Create(plan); var body = new UpdatePlan(input.Name, input.Interval, input.IntervalType, Convert.ToInt32(input.ValueCents * 100), input.PayableWith); Requests.Put($"plans/{plan.Id}", body, Runtime.IuguApiToken); } return(new CommandResult("Plano atualizado com sucesso!", validator.Errors)); }
public Plan Put(UpdatePlan request) { //var plan = request.ConvertTo<Plan>(); Plan plan = new Plan(); plan.Id = request.Id; plan.Name = request.Name; plan.RaceId = request.RaceId; plan.MinSwimWorkouts = request.MinSwimWorkouts; plan.MinBikeWorkouts = request.MinBikeWorkouts; plan.MinRunWorkouts = request.MinRunWorkouts; plan.MaxWorkouts = request.MaxWorkouts; plan.MaxBricks = request.MaxBricks; plan.MinRestDays = request.MinRestDays; Db.Update(plan); return(plan); }
public IActionResult Edit(string id, string token, PlanFormViewModel planFormVm) { // Demo Plan Case if (id == "cVJ58vGy344MnRwc2vO0Z8lR1C669W1V") { return(RedirectToAction("Success", "Plan", new SuccessViewModel { Id = "cVJ58vGy344MnRwc2vO0Z8lR1C669W1V", Token = "2vO0Z8lR1C669W1VcVJ58vGy344MnRwc", SuccessActionName = "changed" })); } // Normal Case var resultVm = new UpdatePlan(planFormVm, id, token, _planRepo).Run(); if (resultVm is SuccessViewModel successViewModel) { successViewModel.SuccessActionName = "changed"; return(RedirectToAction("Success", "Plan", successViewModel)); } // ERROR Handling return(View("Error", resultVm)); }
public override Link GetMyUpdateLink(long ID) { return(UpdatePlan.CreateLink(new { id = ID })); }
public object Post(UpdatePlan request) { return(Store.Put <Plan>(request.Data)); }
public async Task <IActionResult> Update(UpdatePlan bundle) { var result = await _processPlanApiClient.Update(bundle); return(Ok(result)); }