Example #1
0
        // GET: Pessoass/Details/5
        public ActionResult Details(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var pessoa = _service.ReadSingle <PessoaDto>();

            if (pessoa == null)
            {
                return(NotFound());
            }

            return(View(pessoa));
        }
Example #2
0
 public void OnGet(int id)
 {
     Data = _service.ReadSingle <AddRemovePromotionDto>(id);
     if (!_service.IsValid)
     {
         _service.CopyErrorsToModelState(ModelState, Data, nameof(Data));
     }
 }
 public void OnGet(int id)
 {
     Data = _service.ReadSingle <ChangePubDateDto>(id);
     if (!_service.IsValid)
     {
         _service.CopyErrorsToModelState(ModelState, Data, nameof(Data));
     }
 }
Example #4
0
        public IActionResult AddPromotion(Guid id, [FromServices] ICrudServices <SqlEventsDbContext> service)
        {
            var dto = service.ReadSingle <AddRemovePromotionEventsDto>(id);

            if (!service.IsValid)
            {
                service.CopyErrorsToModelState(ModelState, dto);
            }
            SetupTraceInfo();
            return(View(dto));
        }
        public IActionResult RemovePromotion(int id, [FromServices] ICrudServices service)
        {
            var dto = service.ReadSingle <AddRemovePromotionDto>(id);

            if (!service.IsValid)
            {
                service.CopyErrorsToModelState(ModelState, dto);
            }
            SetupTraceInfo();
            return(View(dto));
        }
        public IActionResult ChangePubDate(Guid id, [FromServices] ICrudServices service)
        {
            var dto = service.ReadSingle <ChangePubDateDto>(id);

            if (!service.IsValid)
            {
                service.CopyErrorsToModelState(ModelState, dto);
            }
            SetupTraceInfo();
            return(View(dto));
        }
Example #7
0
        public async Task <IActionResult> Read()
        {
            var user = _services.ReadSingle <User>(a => a.Id == Guid.Parse("32feb0dd-6182-4dc0-9ad6-b147b6fb0cbb"));

            Console.WriteLine("--- user ---");
            Console.WriteLine(user);

            var users = await _services.ReadManyNoTracked <User>().ToListAsync();

            Console.WriteLine("--- users ---");
            Console.WriteLine(JsonSerializer.Serialize(users));

            var usersDto = await _services.ProjectFromEntityToDto <User, UserDto>(a => a).ToListAsync();

            Console.WriteLine($"--- {nameof(usersDto)} ---");
            Console.WriteLine(JsonSerializer.Serialize(usersDto));

            var userDto = await _services.ProjectFromEntityToDto <User, UserDto>(a => a.Where(b => b.Id == Guid.Parse("32feb0dd-6182-4dc0-9ad6-b147b6fb0cbb"))).FirstOrDefaultAsync();

            Console.WriteLine($"--- {nameof(userDto)} ---");
            Console.WriteLine(JsonSerializer.Serialize(userDto));

            return(Ok());
        }
Example #8
0
 public MemberResources Get(int id)
 {
     return(service.ReadSingle <MemberResources>(id));
 }
        public IActionResult BuySuccess([FromServices] ICrudServices <CompanyDbContext> service, string message, int shopSaleId)
        {
            var saleInfo = service.ReadSingle <ListSalesDto>(shopSaleId);

            return(View(new Tuple <ListSalesDto, string>(saleInfo, message)));
        }
Example #10
0
 public AddRemovePromotionDto GetOriginal(int id)
 {
     return _service.ReadSingle<AddRemovePromotionDto>(id);
 }
 public User Get(string username, string password)
 {
     return(service.ReadSingle <User>(u => u.Username == username && u.Password == password));
 }
Example #12
0
        public IActionResult DetailPage(int requestLogId)
        {
            RequestLogDetailModel model = _service.ReadSingle <RequestLogDetailModel>(requestLogId);

            return(View(model));
        }