Esempio n. 1
0
        public GetTenantResponse Save([FromBody] SaveTenantRequest Request)
        {
            RequestInitialization(Request);
            GetTenantResponse response = _tenantService.SaveTenant(Request);

            return(response);
        }
Esempio n. 2
0
        public GetTenantResponse Get(GetTenantRequest Request)
        {
            GetTenantResponse response = new GetTenantResponse();

            Tenant tenant = new Tenant();

            if (Request.Id.HasValue)
            {
                tenant = _uof.TenantRepository.GetById(Request.Id);
            }
            else if (Request.TenantId.HasValue)
            {
                tenant = _uof.TenantRepository.Find(r => r.TenantId == Request.TenantId.Value);
            }

            if (tenant == null)
            {
                response.IsSucceed  = false;
                response.ResultCode = (int)HttpStatusCode.NotFound;
                response.Message    = "Tenant bulunamadı.";

                return(response);
            }

            response.Tenant = _mapper.Map <Tenant, TenantViewModel>(tenant);

            return(response);
        }
Esempio n. 3
0
        public GetTenantResponse SaveTenant(SaveTenantRequest Request)
        {
            GetTenantResponse response = new GetTenantResponse();
            Tenant            entity   = _mapper.Map <TenantViewModel, Tenant>(Request.Tenant);
            var result = _uof.TenantRepository.Insert(entity, Request.ClientUserId);

            if (result == null)
            {
                response.Fail((int)HttpStatusCode.BadRequest, "İşlem Başarısız!");
                return(response);
            }
            return(response);
        }