示例#1
0
 public bool Update(int?id, OrganizationParam organizationParam)
 {
     if (_organizationRepository.Get(id) == null)
     {
         MessageBox.Show("Sorry, your data is not found");
     }
     else
     {
         status = _organizationRepository.Update(id, organizationParam);
     }
     return(status);
 }
        public bool Insert(OrganizationParam organizationParam)
        {
            var result = 0;

            organization.Name        = organizationParam.Name;
            organization.Position    = organizationParam.Position;
            organization.Description = organizationParam.Description;
            organization.DateStart   = organizationParam.DateStart;
            organization.DateEnd     = organizationParam.DateEnd;
            organization.students    = _context.Students.Find(organizationParam.students);
            organization.CreateDate  = DateTimeOffset.Now.LocalDateTime;
            _context.Organizations.Add(organization);
            result = _context.SaveChanges();
            if (result > 0)
            {
                status = true;
                MessageBox.Show("Insert Successfully");
            }
            return(status);
        }
        public bool Update(int?id, OrganizationParam organizationParam)
        {
            var result       = 0;
            var organization = Get(id);

            organization.Name        = organizationParam.Name;
            organization.Position    = organizationParam.Position;
            organization.Description = organizationParam.Description;
            organization.DateStart   = organizationParam.DateStart;
            organization.DateEnd     = organizationParam.DateEnd;
            organization.students    = _context.Students.Find(organizationParam.students);
            organization.UpdateDate  = DateTimeOffset.Now.LocalDateTime;
            result = _context.SaveChanges();
            if (result > 0)
            {
                status = true;
                MessageBox.Show("Update Successfully");
            }
            else
            {
                MessageBox.Show("Update Failed");
            }
            return(status);
        }
示例#4
0
 public bool Insert(OrganizationParam organizationParam)
 {
     return(_organizationRepository.Insert(organizationParam));
 }