| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
-
- using Karsha_Site.Application.Interfaces.Contexts;
- using Karsha_Site.Common.Dto;
- using Karsha_Site.Domain.Entities.About;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.AspNetCore.Http;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace Karsha_Site.Application.Services.About.Commands.InsetAbout
- {
- public interface IInsertAboutServise
- {
- ResultDto<ResultInsertAboutDto> Execute(RequestInsertAboutDto request);
- }
- public class InsertCustomersServise : IInsertAboutServise
- {
-
- private readonly IHostingEnvironment _environment;
- private readonly IDataBaseContext _dataBaseContext;
- public InsertCustomersServise(IDataBaseContext context, IHostingEnvironment hostingEnvironment)
- {
- _dataBaseContext = context;
- _environment = hostingEnvironment;
- }
- public ResultDto<ResultInsertAboutDto> Execute(RequestInsertAboutDto request)
- {
- var about = new AboutUs
- {
- Description = request.Description,
- Email = request.Email,
- Instagram = request.Instagram,
- PostiCode= request.PostiCode,
- PostiSandogh = request.PostiSandogh,
- Title = request.Title,
- };
-
-
- about.InsertTime = DateTime.Now;
-
- _dataBaseContext.Abouts.Add(about);
- _dataBaseContext.SaveChanges();
-
- return new ResultDto<ResultInsertAboutDto>(){
- Data = new ResultInsertAboutDto()
- {
- AboutId = about.ID
- },
- IsSuccess = true,
- Message = "اطلاعات با موفقیت ثبت شد"
- };
- }
-
-
- }
-
- public class RequestInsertAboutDto
- {
- public int AboutId { get; set; }
- public string Title { get; set; }
- public string Description { get; set; }
- public int? PostiCode { get; set; }
- public int? PostiSandogh { get; set; }
- public string Email { get; set; }
- public string Instagram { get; set; }
- }
- public class ResultInsertAboutDto
- {
- public int AboutId { get; set; }
- }
- }
|