public async Task <int> CreateGenderType(CreateGenderTypeDto model) { if (model != null) { var data = new GenderType { Name = model.Name }; await _skinHubAppDbContext.AddAsync(data); await _skinHubAppDbContext.SaveChangesAsync(); return(data.ID); } return(0); }
public async Task <int> CreateProductListType(CreateProductListTypeDto model) { if (model != null) { var data = new ProductListType { Name = model.Name, ProductTypeID = model.ProductTypeID }; await _skinHubAppDbContext.AddAsync(data); await _skinHubAppDbContext.SaveChangesAsync(); return(data.ID); } return(0); }
public async Task <long> CreateReply(CreateReplyDto model) { if (model != null) { var createReply = new Reply { ReplyBody = model.ReplyBody, CreatedOn = model.CreatedOn, Author = model.Author, CommentID = model.CommentID }; await _skinHubAppDbContext.AddAsync(createReply); await _skinHubAppDbContext.SaveChangesAsync(); return(createReply.ID); } return(0); }
public async Task <long> CreateComment(CreateCommentDto model) { if (model != null) { var createComment = new Comment { CommentBody = model.CommentBody, CreatedOn = model.CreatedOn, Author = model.Author, PostID = model.PostID }; await _skinHubAppDbContext.AddAsync(createComment); await _skinHubAppDbContext.SaveChangesAsync(); return(createComment.ID); } return(0); }
public async Task <long> CreatePost(CreatePostDto model) { if (model != null) { var createPost = new Post { Title = model.Title, Body = model.Body, CreatedOn = DateTime.UtcNow, Author = "Annonymous", ProductListTypeID = model.ProductListTypeID }; await _skinHubAppDbContext.AddAsync(createPost); await _skinHubAppDbContext.SaveChangesAsync(); return(createPost.ID); } return(0); }