コード例 #1
0
        public async Task <IActionResult> MobilePhoneType([FromForm] MDOtherItemViewModel model)
        {
            string attachPath = string.Empty;

            if (model.img != null)
            {
                string fileName;
                string message = FileSave.SaveImage(out fileName, "Upload/Attachment/MDOtherItem", model.img);

                if (message == "success")
                {
                    attachPath = fileName;
                }
            }
            MobilePhoneType type = new MobilePhoneType
            {
                Id         = (int)model.id,
                typeName   = model.typeName,
                typeNameBn = model.typeNameBn,
                shortOrder = model.shortOrder,
                imagePath  = attachPath
            };
            await electronicService.SaveMobilePhoneType(type);

            return(RedirectToAction(nameof(MobilePhoneType)));
        }
コード例 #2
0
        public IMobilePhone GetMobilePhone(MobilePhoneType type)
        {
            IMobilePhone mobilePhone = null;

            switch (type)
            {
            case MobilePhoneType.Apple:
                mobilePhone = new Apple();
                break;

            case MobilePhoneType.Samsung:
                mobilePhone = new Samsung();
                break;
            }
            return(mobilePhone);
        }
コード例 #3
0
        public async Task <int> SaveMobilePhoneType(MobilePhoneType mobilePhoneType)
        {
            if (mobilePhoneType.Id != 0)
            {
                _context.MobilePhoneTypes.Update(mobilePhoneType);

                await _context.SaveChangesAsync();

                return(1);
            }
            else
            {
                await _context.MobilePhoneTypes.AddAsync(mobilePhoneType);

                await _context.SaveChangesAsync();

                return(1);
            }
        }
コード例 #4
0
 /// <summary>
 /// Creates a mobile phone of the specified type.
 /// </summary>
 /// <param name="mobilePhoneType">type of phone to create</param>
 public static void CreateMobilePhone(MobilePhoneType mobilePhoneType)
 {
     Function.Call(Hash.CREATE_MOBILE_PHONE, (int)mobilePhoneType);
 }