Exemplo n.º 1
0
        public async Task <int> Addlablemethod(tblLabel objtbllabel)
        {
            int result = 0;

            result = await notesApicontroller.AddLabel(objtbllabel);

            return(result);
        }
Exemplo n.º 2
0
        public async Task <int> AddLabel(tblLabel objtbllabel)
        {
            int result = 0;

            result = await noteService.AddLabel(objtbllabel);

            return(result);
        }
Exemplo n.º 3
0
        public async Task <string> AddLabelAsync(tblLabel objtbllabel)
        {
            try
            {
                objtbllabel.UserID = TempData["UserID"].ToString();
            }
            catch (Exception EX)
            {
                throw;
            }

            string JSONString = string.Empty;

            if (objtbllabel.Label == null)
            {
                string userid = TempData["UserID"].ToString();
                TempData.Keep();
                var list1 = new List <tblLabel>();
                list1 = notesApicontroller.GetLabel(userid);

                JSONString = JsonConvert.SerializeObject(list1);
                return(JSONString);
            }
            else
            {
                int result = 0;
                //UserId = TempData["UserID"].ToString();
                TempData.Keep();
                try
                {
                    if (ModelState.IsValid)
                    {
                        // value = Addlablemethod(objtbllabel);
                        result = await notesApicontroller.AddLabel(objtbllabel);

                        var list1 = new List <tblLabel>();
                        list1 = notesApicontroller.GetLabel(TempData["UserID"].ToString());

                        JSONString = JsonConvert.SerializeObject(list1);
                        return(JSONString);
                    }
                }
                catch (Exception ex)
                {
                    //Logger.Write(ex.ToString());
                }
            }

            return(JSONString);
        }
Exemplo n.º 4
0
        public async Task <int> AddLabel(tblLabel tblLabel)
        {
            int result = 0;

            try
            {
                // Add new label.
                if (tblLabel.Mode == 1)
                {
                    applicationDbContext.tblLabels.Add(tblLabel);
                    result = await applicationDbContext.SaveChangesAsync();

                    return(result);
                }

                if (tblLabel.Mode == 2)
                {
                    tblLabel obj = applicationDbContext.tblLabels.Where <tblLabel>(t => t.ID == tblLabel.ID).First();

                    obj.Label = tblLabel.Label;
                    obj.ID    = tblLabel.ID;
                    result    = await applicationDbContext.SaveChangesAsync();

                    return(result);
                }
                if (tblLabel.Mode == 3)
                {
                    tblLabel obj = applicationDbContext.tblLabels.Where <tblLabel>(t => t.ID == tblLabel.ID).First();

                    applicationDbContext.tblLabels.Remove(obj);
                    result = await applicationDbContext.SaveChangesAsync();

                    return(result);
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            return(result);
        }
Exemplo n.º 5
0
        public string AddLabel(tblLabel model)
        {
            int i = 0;

            try
            {
                _context.tblLabels.Add(model);
                i = _context.SaveChanges();
            }
            catch (Exception ex)
            {
                ex.ToString();
            }


            if (i > 0)
            {
                return("Label Added Successfully");
            }
            else
            {
                return("Something went Wrong");
            }
        }