zinab_elgendy пре 10 месеци
родитељ
комит
b07cec9879

+ 1 - 0
MTWorkHR.Application/Services/User/CompanyService.cs

@@ -52,6 +52,7 @@ namespace MTWorkHR.Application.Services
 
         public override async Task<CompanyDto> Create(CompanyDto input)
         {
+            input.CompanyUser.UserType = UserTypeEnum.Business;
             var userResp = await _userService.Create(input.CompanyUser);
             input.UserId = userResp?.Id;
             var entity = MapperObject.Mapper.Map<Company>(input);

+ 4 - 1
MTWorkHR.Application/Services/User/UserService.cs

@@ -112,7 +112,10 @@ namespace MTWorkHR.Application.Services
             if (!await _fileService.CopyFileToActualFolder(input.UserAttachments.ToList()))
                 throw new AppException(ExceptionEnum.CouldNotMoveFiles);
             var user = MapperObject.Mapper.Map<ApplicationUser>(input);
-
+            if(user.UserType == 0)
+            {
+                user.UserType = (int)UserTypeEnum.Employee;//default if not selected
+            }
             _unitOfWork.BeginTran();
 
             //saving user

+ 20 - 0
MTWorkHR.Core/Entities/User/Company.cs

@@ -0,0 +1,20 @@
+using MTWorkHR.Core.Entities.Base;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTWorkHR.Core.Entities
+{
+    public class Company : FullAuditEntity
+    {
+        public string UserId { get; set; }
+        [Filter]
+        public string CompanyName { get; set; }
+        [Filter]
+        public string CRNumber { get; set; }
+        public int TaxNumber { get; set; }
+    }
+}