public IHttpActionResult GetCountryFromPODfunction(int podid)
        {
            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanRead))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

            BLL.ShippingInstructionMng            bll = new BLL.ShippingInstructionMng();
            Library.DTO.Notification              notification;
            DTO.ShippingInstructionMng.PODCountry data = bll.GetCountryFromPODfunction(podid, out notification);
            return(Ok(new Library.DTO.ReturnData <DTO.ShippingInstructionMng.PODCountry>()
            {
                Data = data, Message = notification, TotalRows = 0
            }));
        }
Exemplo n.º 2
0
        public DTO.ShippingInstructionMng.PODCountry GetCountryFromPODfunction(int podid, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.ShippingInstructionMng.PODCountry data = new DTO.ShippingInstructionMng.PODCountry();

            //try to get data
            try
            {
                using (ShippingInstructionMngEntities context = CreateContext())
                {
                    data = converter.DB2DTO_PODCountry(context.ShippingInstructionMng_PODCountry_View.FirstOrDefault(o => o.PoDID == podid));
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }