Example #1
0
        /// <summary>
        /// Get a single establishment
        /// </summary>
        /// <param name="id">string guid</param>
        /// <returns></returns>
        public DTOEstablishmentInfo GetEstablishment(string id)
        {
            var result = new DTOEstablishmentInfo();

            try
            {
                result = _IRepository.GetEstablishment(id);
            }
            catch (Exception ex)
            {
                result.IsSuccessful = false;
                result.ErrorMsg     = "BLL Error - " + ex.Message;
            }

            return(result);
        }
Example #2
0
        public DTOEstablishmentInfo UpdateEstablishment(DTOEstablishmentInfo data)
        {
            var result = new DTOEstablishmentInfo();

            try
            {
                result = _IRepository.Update <DTOEstablishmentInfo, DTOEstablishmentInfo>(data);
                result.IsSuccessful = true;
            }
            catch (Exception ex)
            {
                result.IsSuccessful = false;
                result.ErrorMsg     = "BL Error: " + ex.Message;
            }
            return(result);
        }
        /// <summary>
        /// Get a single establishment
        /// </summary>
        /// <param name="id">string guid</param>
        /// <returns></returns>
        public DTOEstablishmentInfo GetEstablishment(string id)
        {
            var entity = new NoVacancyEntities();

            var result = new DTOEstablishmentInfo();

            try
            {
                var data = (from establishment in entity.trEstablishments
                            where establishment.Guid.ToString() == id
                            select new DTOEstablishmentInfo {
                    Guid = establishment.Guid,
                    Name = establishment.Name,
                    EstablishmentTypeID = establishment.EstablishmentTypeID,
                    ContactPerson = establishment.ContactPerson,
                    Email = establishment.Email,
                    Mobile = establishment.Mobile,
                    Telephone = establishment.Telephone,
                    Fax = establishment.Fax,
                    WebSite = establishment.WebSite,
                    Address = establishment.Address,
                    CountryID = establishment.CountryID,
                    CityID = establishment.CityID,
                    Location = establishment.Location,
                    Lat = establishment.Lat,
                    Lng = establishment.Lng,
                    Active = establishment.Active,
                    DateDeactivated = establishment.DateDeactivated,
                }).FirstOrDefault();

                result = data;
                result.IsSuccessful = true;
            }
            catch (Exception ex)
            {
                result.IsSuccessful = false;
                result.ErrorMsg     = "DAL Error - " + ex.Message;
            }

            return(result);
        }