[ProducesResponseType(StatusCodes.Status500InternalServerError)] // if something unexpectedly went wrong with the database or http request/response public async Task <ActionResult <Furs2Feathers.Domain.Models.Plan> > PostPlan(Furs2Feathers.Domain.Models.Plan plan) { planRepo.Add(plan); await planRepo.SaveChangesAsync(); return(CreatedAtAction("GetPlan", new { id = plan.PlanId }, plan)); }
public void Add(PlanAddModel model) { var plan = new Plan(model.Name, model.Price, model.Period, model.OrderIndex, model.PlanCode, true); _planRepository.Add(plan); _unitOfWork.Commit(); }
//Thêm Brand mới vào bảng Plan public async Task <bool> Add(PlanDto model) { var plan = _mapper.Map <Plan>(model); _repoPlan.Add(plan); return(await _repoPlan.SaveAll()); }
public void Add(PlanDTO planDto) { var plans = new List <Plan>(); for (var i = 0; i < planDto.MealIds.Count; i++) { plans.Add(new Plan { Date = planDto.Date, EditableFrom = planDto.EditableFrom, EditableTo = planDto.EditableTo, Shifts = string.Join(",", planDto.Shifts), CompanyId = planDto.CompanyId, MealId = planDto.MealIds[i] }); } _planRepository.Add(plans); }
public async Task <PlanView> AddPlanAsync(NewPlanInput input) { var entity = input.ToEntity(); var result = _planRepository.Add(entity); var planEntity = await result.ProjectToPlanView().FirstOrDefaultAsync(); var item = planEntity; return(item); }
public void AddNewPlan_SuccessfulAdd() { var newPlan = new PlanEntity() { Id = 2, Name = "Second Plan", DurationInWeeks = 4, StartingDateUtc = new DateTime(2020, 2, 22), IsActive = true, }; var result = _planRepository.Add(newPlan); Assert.IsAssignableFrom <IQueryable <PlanEntity> >(result); Assert.NotEmpty(result); Assert.NotNull(result.SingleOrDefault()); Assert.True(result.SingleOrDefault()?.IsActive); Assert.Equal(2, _planRepository.GetCount()); Assert.NotEqual(1, _planRepository.GetCount()); }
//Thêm Brand mới vào bảng Plan public async Task <bool> Add(PlanDto model) { var plan = _mapper.Map <Plan>(model); plan.CreatedDate = DateTime.Now; plan.BPFCEstablishID = model.BPFCEstablishID; _repoPlan.Add(plan); var result = await _repoPlan.SaveAll(); await _hubContext.Clients.All.SendAsync("summaryRecieve", "ok"); return(result); }
public void Add(Plan entity) { _planRepository.Add(entity); }
public int AddPlan(BLModel.Plan plan) { return(_planRepository.Add((DLModel.Plan) new DLModel.Plan().InjectFrom(plan)).PlanID); }