private async Task AddDesignReference_ShouldWorkFine() { var context = ContextInitializer.InitializeContext(); await this.SeedData(context); this.designBoardServce = new DesignBoardService(context); var designBoard = new DesignBoardCreateInputModel { ProjectId = "bb2bd817-98cd-4cf3-a80a-53ea0cd9c200", CustomerId = new Guid("cb2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(), Name = "Test Design Board", }; var designRefernce = new ReferenceInputModel { CustomerId = new Guid("cb2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(), ImageUrl = "https://test.test", DesignBoardId = "de2bd817-98cd-4cf3-a80a-53ea0cd9c200", }; await this.designBoardServce.AddDesignBoard(designBoard); var result = await this.designBoardServce.AddDesignReference(designRefernce); Assert.Equal("DesignReference created successfully!", result); }
public async Task <IActionResult> Create(DesignBoardCreateInputModel model) { if (this.ModelState.IsValid) { await this.designBoardService.AddDesignBoard(model); } return(this.RedirectToAction("Details", "Project", new { id = model.ProjectId })); }
public async Task <IActionResult> Create(string id) { var model = new DesignBoardCreateInputModel { ProjectId = id, CustomerId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value, }; return(this.View(model)); }
public async Task <string> AddDesignBoard(DesignBoardCreateInputModel model) { var designBoard = new DesignBoard { Name = model.Name, CustomerId = model.CustomerId, ProjectId = model.ProjectId, }; this.context.DesignBoards.Add(designBoard); await this.context.SaveChangesAsync(); return("DesignBoard created successfully!"); }