Esempio n. 1
0
        public IEnumerable <Label> GetLabels(Topic topic, ImageLabel imageLabel)
        {
            #region validation

            if (topic == null)
            {
                throw new ArgumentNullException(nameof(topic));
            }

            if (imageLabel == null)
            {
                throw new ArgumentNullException(nameof(imageLabel));
            }

            #endregion

            IEnumerable <Label> labels = LabelRepository.GetLabels(topic, imageLabel).ToList();

            if (labels.Any(o => string.IsNullOrEmpty(o.ObjectClassName)))
            {
                // load objectclasses only when labels includes where name of objectclass is not set
                List <ObjectClass> objectClasses = ObjectClassRepository.GetObjectClasses(topic).ToList();
                foreach (Label label in labels)
                {
                    label.ObjectClassName = objectClasses.GetObjectClass(label.ObjectClassId).Name;
                }
            }

            return(labels);
        }
Esempio n. 2
0
        /// <summary>
        /// obtains a list of tags
        /// </summary>
        /// <returns>returns the result to action</returns>
        public JsonResult GetTags()
        {
            LabelRepository objtag = new LabelRepository(SessionCustom);

            objtag.Entity.LanguageId = CurrentLanguage.LanguageId;
            return(this.Json(objtag.GetLabels(), JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
 public async Task <ActionResult <List <Label> > > GetLabels()
 {
     return(await lr.GetLabels(HttpContext.Items["UserID"].ToString()));
 }