public JsonData Update(Country entity, string userId)
        {
            try
            {
                using (var db = new DataContext())
                {
                    if (entity == null) throw new ArgumentNullException("The record is" + " record is null");

                    var country = db.Countries.FirstOrDefault(x => x.Id == entity.Id);

                    if (country != null)
                    {
                        country.Name = entity.Name;
                        country.Description = entity.Description;
                        country.ShortCode = entity.ShortCode;
                        country.Updated = DateTime.Now;
                        country.UpdatedById = userId;
                    }

                    db.SaveChanges();

                    return DataHelpers.ReturnJsonData(entity, true, "Updated successfully", 1);
                }
            }
            catch (Exception e)
            {
                return DataHelpers.ExceptionProcessor(e);
            }
        }
        public JsonData Insert(Country entity, string userId)
        {
            try
            {
                using (var db = new DataContext())
                {
                    if (entity == null) throw new ArgumentNullException("The new" + " record is null");

                    var newData = new Country
                    {
                        Name = entity.Name,
                        Description = entity.Description,
                        ShortCode = entity.ShortCode,
                        Updated = DateTime.Now,
                        Created = DateTime.Now,
                        IsActive = true,
                        IsDeleted = false,
                        CreatedById = userId,
                        UpdatedById = userId
                    };

                    db.Countries.Add(newData);
                    db.SaveChanges();

                    return DataHelpers.ReturnJsonData(newData, true, "Saved successfully", 1);
                }
            }
            catch (Exception e)
            {
                return DataHelpers.ExceptionProcessor(e);
            }
        }
 public JsonData Insert(Country data)
 {
     return new CountryRepo().Insert(data, User.Identity.GetUserId());
 }
 public JsonData Update(Country data)
 {
     return new CountryRepo().Update(data, User.Identity.GetUserId());
 }
 public JsonData Countries(Country filter)
 {
     return new ReportRepo().Countries(new CountryFilter{Name = filter.Name, ShortCode = filter.ShortCode});
 }